You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this code, when i try to run it i get 'ImportError: cannot import name 'walk' from 'puresnmp' (/home/rojin/.local/lib/python3.10/site-packages/puresnmp/init.py)'
from pysnmp.hlapi import *
from puresnmp import walk
IP = "10.10.10.254"
COMMUNITY = 'public'
OID = '1.3.6.1.2.1.2.2.1.2'
for row in puresnmp.walk(IP, COMMUNITY, OID):
print(row)
IP = "10.10.10.254"
COMMUNITY = 'public'
OID = '1.3.6.1.2.1.2.2.1.8'
for row in walk(IP, COMMUNITY, OID):
print(row)
#Indiviaual Reason on Switch/Router
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.2.1.2.2.1.2.10113')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
#Indiviaual Reason on Switch/Router
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.2.1.2.2.1.2.10113')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
#Reboot Reason on Switch/Router
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.4.1.9.2.1.2.0')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
#System Uptime on Switch/Router
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.2.1.1.3.0')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
#Power Value
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.4.1.9.9.13.1.5.1.3.1006')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
#FAN Value
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.4.1.9.9.13.1.4.1.3.1007')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
#System Temperature Value
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.4.1.9.9.13.1.3.1.3.1008')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
#Monitoring CPU on Switch/Router
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.4.1.9.2.1.58.0')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
#Monitoring Memory on Switch/Router
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.4.1.9.9.48.1.1.1.6.1')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
#Version Detail of Switch/Router
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.2.1.1.1.0')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
#Total Number of Interfaces/Vlan
g = getCmd(
SnmpEngine(), CommunityData('public'), UdpTransportTarget(
('10.10.10.254', 161)), ContextData(), ObjectType(
ObjectIdentity('1.3.6.1.2.1.2.1.0')))
errorIndication, errorStatus, errorIndex, varBinds = next(g)
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
The text was updated successfully, but these errors were encountered:
I have this code, when i try to run it i get 'ImportError: cannot import name 'walk' from 'puresnmp' (/home/rojin/.local/lib/python3.10/site-packages/puresnmp/init.py)'
The text was updated successfully, but these errors were encountered: