June 2018
Intermediate to advanced
398 pages
9h
English
In this use case, we will utilize the pysnmp module to send SNMP GET requests to our router, retrieve the input and output traffic rates for a specific interface, and visualize the output using the matplotlib library. The OIDs used are .1.3.6.1.4.1.9.2.2.1.1.6 and .1.3.6.1.4.1.9.2.2.1.1.8, which represent the input and output rates respectively:
from pysnmp.entity.rfc3413.oneliner import cmdgenimport timeimport matplotlib.pyplot as pltcmdGen = cmdgen.CommandGenerator()snmp_community = cmdgen.CommunityData('public')snmp_ip = cmdgen.UdpTransportTarget(('10.10.88.110', 161))snmp_oids = [".1.3.6.1.4.1.9.2.2.1.1.6.3",".1.3.6.1.4.1.9.2.2.1.1.8.3"]slots = 0input_rates = []output_rates = []while slots <= 50: errorIndication ...
Read now
Unlock full access