1

I'm trying to query switches in our environment using the EasySNMP python3 package. In our environment we have multiple switches of the same hardware model. I've got 2 switches. Switch_A and Switch_B.

When I try to query them using the bash snmpget command both return the requested data:

snmpget -v3 -l authPriv -u userA -a MD5 -A auth_pass -x DES -X priv_pass Switch_A.example.com sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: Switch_A_config_v2
snmpget -v3 -l authPriv -u userA -a MD5 -A auth_pass -x DES -X priv_pass Switch_B.example.com sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING:Switch_B_config_v2

When I try querying them using the Python3 (3.6.8) Easysnmp module 1 of the switches returns the expected data but the other results in a TimeoutError and I really can't figure out why.

easysnmp.snmp_get(['sysDescr.0'], hostname='Switch_A.example.com', security_username='userA', auth_protocol='MD5', auth_password='auth_pass', version=3, security_level='auth_with_privacy', privacy_password='priv_pass', privacy_protocol='DES')
[<SNMPVariable value='Switch_A_config_v2' (oid='sysDescr', oid_index='0', snmp_type='OCTETSTR')>]
easysnmp.snmp_get(['sysDescr.0'], hostname='Switch_B.example.com', security_username='userA', auth_protocol='MD5', auth_password='auth_pass', version=3, security_level='auth_with_privacy', privacy_password='priv_pass', privacy_protocol='DES')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib64/python3.6/site-packages/easysnmp/easy.py", line 22, in snmp_get
    return session.get(oids)
  File "/usr/local/lib64/python3.6/site-packages/easysnmp/session.py", line 315, in get
    interface.get(self, varlist)
easysnmp.exceptions.EasySNMPTimeoutError: timed out while connecting to remote host

Obviously I've changed the passwords and URL's and stuff, but the ONLY thing I've changed is the value of the DNS name between tests.

Any help would be greatly appreciated. Cheers, John

7th Sin
  • 11
  • 3

0 Answers0