Created
March 23, 2020 14:52
-
-
Save bandit145/0b267678900d1bf189a5a93c99f7ed8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pysnmp.hlapi as pysnmp | |
COMMUNITY = pysnmp.CommunityData('data') | |
ADDRESS = '' | |
DATA = 'cdpCacheDeviceId' | |
table_results = pysnmp.nextCmd(pysnmp.SnmpEngine(), COMMUNITY, pysnmp.UdpTransportTarget((ADDRESS, 161)), pysnmp.ContextData(), | |
pysnmp.ObjectType(pysnmp.ObjectIdentity('CISCO-CDP-MIB', DATA)), lexicographicMode=False) | |
count = 0 | |
for row in table_results: | |
print('Row: '+str(count)) | |
for item in row: | |
if item: | |
print('\t'+str(item[0])) | |
count += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment