| Home | Trees | Indices | Help |
|---|
|
|
1 """ 2 The snmpget service in pure Python. 3 """ 4 5 #from pysnmp.entity.rfc3413.oneliner import cmdgen 6 from service import Service 7 834 #cmdGen = cmdgen.CommandGenerator() 35 36 #errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd( 37 # cmdgen.CommunityData(self.community), 38 # cmdgen.UdpTransportTarget((self._host, self.port)), 39 # cmdgen.MibVariable(self.oid) 40 #) 41 42 #if errorIndication: 43 # print(errorIndication) 44 #else: 45 # if errorStatus: 46 # print('%s at %s' % ( 47 # errorStatus.prettyPrint(), 48 # errorIndex and varBinds[int(errorIndex) - 1] or '?' 49 # )) 50 # else: 51 # for name, val in varBinds: 52 # print('%s = %s' % (name.prettyPrint(), val.prettyPrint())) 53 5411 super(SnmpgetService, self).__init__(**kwargs) 12 13 args = self.get_arguments() 14 15 if "community" in args: 16 self.community = args["community"] 17 else: 18 raise Exception("There is no community") 19 20 if "oid" in args: 21 self.oid = args["oid"] 22 else: 23 raise Exception("There is no oid") 24 25 self.port = "161" 26 if "port" in args: 27 self.port = args["port"]28 3156 return SnmpgetService(**kwargs)57
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Wed Jun 19 03:26:57 2013 | http://epydoc.sourceforge.net |