Advertisement
Guest User

2in1

a guest
Dec 21st, 2014
491
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. #!/usr/local/bin/python
  2. #coding=UTF8
  3.  
  4. import netsnmp, time
  5.  
  6. host  = '10.90.90.90'
  7. rcomm = 'public'
  8.  
  9. start=time.time()
  10. oid = (netsnmp.VarList(
  11.     netsnmp.Varbind('.1.3.6.1.2.1.2.2.1.10'),
  12.     netsnmp.Varbind('.1.3.6.1.2.1.2.2.1.16'),
  13.     ))
  14. res = netsnmp.snmpwalk(oid, Version = 2, DestHost = host, Community = rcomm, Timeout = 150000, Retries = 0, UseNumeric = 1)
  15. for o in oid:
  16.     print "index: {}, vid: {}, type: {}, value: {}".format(o.tag,o.iid,o.type,o.val)
  17. print "\nElapsed Time: {:.4f}".format(time.time() - start)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement