Compare commits
No commits in common. "ae504c9c55682b9e4edd462ae2bb5a08c659830f" and "0425e67beb49786802aeadfeb2e2c20d7e6baec4" have entirely different histories.
ae504c9c55
...
0425e67beb
|
@ -5,16 +5,9 @@ import subprocess
|
|||
|
||||
class Mpod:
|
||||
def __init__(self, ip):
|
||||
#check SNMP version
|
||||
version = str(subprocess.check_output(['snmpwalk', '-V'], stderr=subprocess.STDOUT).decode("ascii"))
|
||||
versionNum = float(version[17:-3])
|
||||
self.IP = ip
|
||||
if versionNum < 5.8 :
|
||||
print(">>>>>> snmp version < 5.8, does not support high precision.")
|
||||
self.cmd0Str = "-v2c -m +WIENER-CRATE-MIB -c guru %s " % self.IP
|
||||
else:
|
||||
self.cmd0Str = "-v2c -Op .12 -m +WIENER-CRATE-MIB -c guru %s " % self.IP
|
||||
|
||||
#cmd0Str = "-v2c -m +WIENER-CRATE-MIB -c guru 128.186.111.101 "
|
||||
self.cmd0Str = "-v2c -Op .12 -m +WIENER-CRATE-MIB -c guru %s " % self.IP
|
||||
self.isConnected = False
|
||||
print( "testing communication via " + self.IP)
|
||||
cmdStr = "snmpwalk " + self.cmd0Str
|
||||
|
@ -22,15 +15,8 @@ class Mpod:
|
|||
result = str(subprocess.check_output(cmdStr, shell=True))
|
||||
print( result )
|
||||
self.isConnected = True
|
||||
kaka = self.GetChList()
|
||||
print(" channel list : ")
|
||||
print(kaka)
|
||||
if len(kaka) == 1 :
|
||||
print(">>>>> cannot get channels list, probably modules switched off\n")
|
||||
else:
|
||||
self.isConnected = False
|
||||
except :
|
||||
print(">>>>>> cannot establish communitation via " + self.IP)
|
||||
print("cannot establish communitation via " + self.IP)
|
||||
|
||||
def SetIP(self, ip):
|
||||
self.__init__(ip)
|
||||
|
@ -47,7 +33,6 @@ class Mpod:
|
|||
cmdStr = "echo option: 0 - get, 1 - set, 2 - walk"
|
||||
#print(cmdStr)
|
||||
result = str(subprocess.check_output(cmdStr, shell=True))
|
||||
#print(result)
|
||||
return result.lstrip('b\'').rstrip('\'').rstrip('\n')
|
||||
|
||||
#======== Get settings
|
||||
|
|
Loading…
Reference in New Issue
Block a user