Skip to main content

Simplified Paramiko Library to Fetch Data From MultiVendor Network Devices

Project description


Simplified Paramiko Library to Fetch Data From MultiVendor Network Devices


  • Cisco IOS
  • Cisco IOS-XE
  • Cisco NX-OS
  • Cisco IOS-XR
  • Juniper Junos
  • Huawei VRP5/8
  • DELL OS10
  • Ericsson IPOS

Script is based on paramiko and catches device-prompt to understand the output is fetched, thus there is a strong possibility that script could work with many network devices from different vendors, i only do not have the chance to test.

Accepted Network Device OS Types

  • huawei-vrp
  • cisco-ios
  • cisco-iosxe
  • cisco-iosxr
  • cisco-nxos
  • junos
  • dell-os10
  • zte-zxros
  • ericsson-ipos
  • nokia-sros

For the above device type pagination commands (e.g. "terminal length 0") send automatically.

Simple Example

import simplefetch

test_router = simplefetch.SSH("", port=22,user="admin", passwd="secret", network_os="cisco-ios")
print (test_router.fetchdata("show version"))

Example with Logging

import simplefetch,logging
logging.basicConfig(filename='info.log', filemode='a', level=logging.INFO,
                    format='%(asctime)s [%(name)s] %(levelname)s (%(threadName)-10s): %(message)s')

test_router = simplefetch.SSH("" port=22, user="admin", passwd="secret", network_os="cisco-ios")
print (test_router.fetchdata("show version"))

Example with Multithreading Python3

# -*- coding: utf-8 -*-
import simplefetch
import logging, time
from threading import Thread
timestr = time.strftime("%Y%m%d-%H%M%S")

#================== Logging
logging.basicConfig(filename=log_filename, filemode='a', level=logging.INFO,
                    format='%(asctime)s [%(name)s] %(levelname)s (%(threadName)-10s): %(message)s')

#==================USER, PASS, ROUTER_LIST==============
username= "username"

#================== MEMORY check function for huawei devices
def get_memory_usages(router_name):
		connection = simplefetch.SSH(user=username, passwd=password, network_os="huawei-vrp")
			display_health_raw= connection.fetchdata("display startup")
			print (router_name)
			print (display_health_raw)
			logging.warning ("could not get output of command from %s",router_name)
		logging.warning ("connection unsuccessful to %s",router_name)

#================== multithread part 
import concurrent.futures 
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: 
	for items in router_list:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for simplefetch, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size simplefetch-0.1.0.tar.gz (4.6 kB) File type Source Python version None Upload date Hashes View
Filename, size simplefetch-0.1.0-py3-none-any.whl (10.3 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page