Module: check_mk
Branch: master
Commit: 9a8cf64dcb9f4990569a32d10a245e7367d7dcea
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9a8cf64dcb9f49…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri May 26 09:08:40 2017 +0200
4594 FIX snmp_uptime: Fixed uptime
Change-Id: I3feae45fcac32971be69a9f37f7d8de4de61c3ee
---
.werks/4594 | 12 ++++++++++++
checks/snmp_uptime | 13 +++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/.werks/4594 b/.werks/4594
new file mode 100644
index 0000000..97576dc
--- /dev/null
+++ b/.werks/4594
@@ -0,0 +1,12 @@
+Title: snmp_uptime: Fixed uptime
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1493975963
+Class: fix
+
+On Linux appliances {{.1.3.6.1.2.1.1.3.0}} means uptime of snmpd and
+{{.1.3.6.1.2.1.25.1.1.0}} the system uptime. Use second value if it
+is available.
diff --git a/checks/snmp_uptime b/checks/snmp_uptime
index d123e70..d4bf2ee 100644
--- a/checks/snmp_uptime
+++ b/checks/snmp_uptime
@@ -29,8 +29,12 @@ def inventory_snmp_uptime(info):
if len(info) > 0 and len(info[0]) >= 1:
return [ (None, {}) ]
+
def check_snmp_uptime(checktype, params, info):
- uptime = parse_snmp_uptime(info[0][0])
+ if info[0][1]:
+ uptime = parse_snmp_uptime(info[0][1])
+ else:
+ uptime = parse_snmp_uptime(info[0][0])
return check_uptime_seconds(params, uptime)
@@ -39,7 +43,12 @@ check_info["snmp_uptime"] = {
'inventory_function' : inventory_snmp_uptime,
'service_description' : 'Uptime',
'has_perfdata' : True,
- 'snmp_info' : ('.1.3.6.1.2.1.1', ['3.0']), #
DISMAN-EVENT-MIB::sysUpTime
+ # On Linux appliances: .1.3.6.1.2.1.1.3.0 means uptime of snmpd
+ # .1.3.6.1.2.1.25.1.1.0 means system uptime
+ 'snmp_info' : ('.1.3.6.1.2.1', [
+ '1.3', # DISMAN-EVENT-MIB::sysUpTime
+ '25.1.1', # HOST-RESOURCES-MIB::hrSystemUptime
+ ]),
'snmp_scan_function' : lambda oid: oid(".1.3.6.1.2.1.1.1.0")
not in [ None, "" ],
'group' : 'uptime',
'includes' : [ 'uptime.include' ],