- Timestamp:
- Feb 13, 2013, 7:35:56 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/check-batch-cmd
r11053 r11727 17 17 18 18 SSHPASS = None 19 import pysnmp20 from pysnmp.entity.rfc3413.oneliner import cmdgen21 19 import netsnmp 22 23 def snmp_test():24 errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd(25 # SNMP v126 # cmdgen.CommunityData('test-agent', 'public', 0),27 # SNMP v228 cmdgen.CommunityData('test-agent', 'public'),29 # SNMP v330 # cmdgen.UsmUserData('test-user', 'authkey1', 'privkey1'),31 cmdgen.UdpTransportTarget(('localhost', 161)),32 # Plain OID33 (1,3,6,1,2,1,1,1,0),34 # ((mib-name, mib-symbol), instance-id)35 (('SNMPv2-MIB', 'sysObjectID'), 0)36 )37 38 if errorIndication:39 print errorIndication40 else:41 if errorStatus:42 print '%s at %s\n' % (43 errorStatus.prettyPrint(),44 errorIndex and varBinds[int(errorIndex)-1] or '?'45 )46 else:47 for name, val in varBinds:48 print '%s = %s' % (name.prettyPrint(), val.prettyPrint())49 50 51 20 52 21 class CmdError(Exception):
Note:
See TracChangeset
for help on using the changeset viewer.