Module: check_mk
Branch: master
Commit: 7deaf9ead161443dee68292eb9a82140da665217
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7deaf9ead16144…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Dec 15 11:54:27 2011 +0100
FIX: snmp_uptime: fixed alternative time output
---
ChangeLog | 1 +
checks/snmp_uptime | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 739f6a0..999c096 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -100,6 +100,7 @@
* FIX: lnx_if: assume interfaces as up if ethtool is missing or
not working but interface has been used since last reboot. This
fixes the problem where interface are not found by inventory.
+ * FIX: snmp_uptime: handels alternative timeformat * FIX: snmp_uptime: handels
alternative timeformat
1.1.12p4:
Multisite:
diff --git a/checks/snmp_uptime b/checks/snmp_uptime
index dbcf882..7b20d07 100644
--- a/checks/snmp_uptime
+++ b/checks/snmp_uptime
@@ -33,7 +33,12 @@ def inventory_snmp_uptime(info):
def check_snmp_uptime(checktype, _no_params, info):
if len(info[0]) >= 1:
ticks = info[0][0]
- uptime = saveint(ticks[:-2])
+ try:
+ uptime = int(ticks[:-2])
+ except:
+ days, h, m, s = ticks.split(":")
+ uptime = (int(days) * 86400 ) + (int(h) * 3600) + (int(m) * 60) +
int(float(s))
+
days, rest = divmod(uptime, 60*60*24)
hours, rest = divmod(rest, 60*60)
minutes, seconds = divmod(rest, 60)