Commit e998ced2b2ae3b38f6e69f12a498ad4c388bc0a5

Authored by Eduardo Santos
Committed by Eduardo Santos
1 parent 29015b10
Exists in master

Corrige timeout

Showing 1 changed file with 6 additions and 3 deletions   Show diff stats
cocar/session.py
@@ -32,6 +32,7 @@ class SnmpSession(object): @@ -32,6 +32,7 @@ class SnmpSession(object):
32 DestHost="localhost", 32 DestHost="localhost",
33 Community="public", 33 Community="public",
34 Verbose=True, 34 Verbose=True,
  35 + Timeout=10000000
35 ): 36 ):
36 """ 37 """
37 Sessão SNMP. Links úteis: 38 Sessão SNMP. Links úteis:
@@ -49,6 +50,7 @@ class SnmpSession(object): @@ -49,6 +50,7 @@ class SnmpSession(object):
49 self.DestHost = DestHost 50 self.DestHost = DestHost
50 self.Community = Community 51 self.Community = Community
51 self.Verbose = Verbose 52 self.Verbose = Verbose
  53 + self.Timeout = Timeout
52 self.var = netsnmp.Varbind(oid, iid) 54 self.var = netsnmp.Varbind(oid, iid)
53 self.hostrec = Host() 55 self.hostrec = Host()
54 self.hostrec.hostname = self.DestHost 56 self.hostrec.hostname = self.DestHost
@@ -56,8 +58,8 @@ class SnmpSession(object): @@ -56,8 +58,8 @@ class SnmpSession(object):
56 self.status = ['.1.3.6.1.2.1.25.3.5.1.1.1'] 58 self.status = ['.1.3.6.1.2.1.25.3.5.1.1.1']
57 self.serial = ['.1.3.6.1.2.1.43.5.1.1.17', 59 self.serial = ['.1.3.6.1.2.1.43.5.1.1.17',
58 '.1.3.6.1.2.1.43.5.1.1.17.1', 60 '.1.3.6.1.2.1.43.5.1.1.17.1',
59 - '1.3.6.1.4.1.641.2.1.2.1.6.1',  
60 - '1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0'] 61 + '.1.3.6.1.4.1.641.2.1.2.1.6.1',
  62 + '.1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0']
61 self.model = ['.1.3.6.1.2.1.25.3.2.1.3.1', 63 self.model = ['.1.3.6.1.2.1.25.3.2.1.3.1',
62 '.1.3.6.1.4.1.641.2.1.2.1.2.1'] 64 '.1.3.6.1.4.1.641.2.1.2.1.2.1']
63 self.counter = ['.1.3.6.1.2.1.43.10.2.1.4.1.1'] 65 self.counter = ['.1.3.6.1.2.1.43.10.2.1.4.1.1']
@@ -72,7 +74,8 @@ class SnmpSession(object): @@ -72,7 +74,8 @@ class SnmpSession(object):
72 result = netsnmp.snmpget(self.var, 74 result = netsnmp.snmpget(self.var,
73 Version=self.Version, 75 Version=self.Version,
74 DestHost=self.DestHost, 76 DestHost=self.DestHost,
75 - Community=self.Community) 77 + Community=self.Community,
  78 + Timeout=self.Timeout)
76 self.hostrec.query = result 79 self.hostrec.query = result
77 except Exception, err: 80 except Exception, err:
78 if self.Verbose: 81 if self.Verbose: