Module: check_mk
Branch: master
Commit: a95a4b98ef3081d16cd2ea0e33b49ac68fd6fb57
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a95a4b98ef3081…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Sep 13 10:45:58 2013 +0200
Added timing/retries handling to new snmp code
---
modules/snmp.py | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/modules/snmp.py b/modules/snmp.py
index 6b5f3a1..064d6a8 100644
--- a/modules/snmp.py
+++ b/modules/snmp.py
@@ -107,11 +107,20 @@ def init_snmp_host(hostname):
sys.stdout.write("Cannot resolve %s into IP address. Skipping.\n" %
hostname)
return None
- # FIXME: Whan about timing / retries?
+ timing = snmp_timing_of(hostname)
+ timeout = int(timing.get("timeout", 1) * 1000000) # default: 1 second
+ retries = timing.get('retries', 3)
+
if version != 3:
- s = netsnmp.Session(Version = version, DestHost = ipaddress, Community =
credentials)
+ s = netsnmp.Session(Version = version, DestHost = ipaddress,
+ Timeout = timeout,
+ Retries = retries,
+ Community = credentials,
+ )
else:
s = netsnmp.Session(Version = version, DestHost = ipaddress,
+ Timeout = timeout,
+ Retries = retries,
SecLevel = sec_level,
AuthProto = auth_proto.upper(),
AuthPass = auth_pass,