Unable to get Fetch SNMP variable details using sample posted at (https://snmplabs.thola.io/pysnmp/quick-start.html) and got error response . please advice how to fix the error . Thanks in advance
Traceback (most recent call last):
File "d:/WorkFiles/SNMPTest/SNMP.py", line 6, in <module>
UdpTransportTarget(('snmpsim.try.thola.io', 161)),
File "D:\Python37\lib\site-packages\pysnmp\hlapi\transport.py", line 19, in __init__
self.transportAddr = self._resolveAddr(transportAddr)
File "D:\Python37\lib\site-packages\pysnmp\hlapi\asyncore\transport.py", line 63, in _resolveAddr
'@'.join([str(x) for x in transportAddr]), sys.exc_info()[1]))
pysnmp.error.PySnmpError: Bad IPv4/UDP transport address snmpsim.try.thola.io@161: [Errno 11001] getaddrinfo failedcaused by <class 'socket.gaierror'>: [Errno 11001] getaddrinfo failed
**
- Code used for testing
**
from pysnmp.hlapi import *
errorIndication, errorStatus, errorIndex, varBinds = next(
getCmd(SnmpEngine(),
CommunityData('public', mpModel=0),
UdpTransportTarget(('snmpsim.try.thola.io', 161)),
ContextData(),
ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)))
)
if errorIndication:
print(errorIndication)
elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
else:
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))