[checkmk-commits] Check_MK Git: check_mk: FIX snmp_uptime: no longer fails if uptime is < 1 seconds

Andreas Boesl ab at mathias-kettner.de
Tue Feb 11 17:30:56 CET 2014


Module: check_mk
Branch: master
Commit: 74d285c33911f4a2ad1abcc14f8e612752516131
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=74d285c33911f4a2ad1abcc14f8e612752516131

Author: Andreas Boesl <ab at mathias-kettner.de>
Date:   Tue Feb 11 17:30:23 2014 +0100

FIX snmp_uptime: no longer fails if uptime is < 1 seconds

---

 .werks/555         |    9 +++++++++
 ChangeLog          |    1 +
 checks/snmp_uptime |    5 ++++-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/.werks/555 b/.werks/555
new file mode 100644
index 0000000..b3bccfb
--- /dev/null
+++ b/.werks/555
@@ -0,0 +1,9 @@
+Title: snmp_uptime: no longer fails if uptime is < 1 seconds
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1392136196
+
+
diff --git a/ChangeLog b/ChangeLog
index c1e2fd7..c56069a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -174,6 +174,7 @@
     * 0281 FIX: statgrab_net.ctr: only inventorize interfaces with actual traffic...
     * 0582 FIX: cisco_sys_mem: check now has a man page and a new WATO integration
     * 0667 FIX: oracle_asm_diskgroup: Now really uses the generic filesystem levels...
+    * 0555 FIX: snmp_uptime: no longer fails if uptime is < 1 seconds
 
     Multisite:
     * 0371 Added log class filter to hostsvcevents view
diff --git a/checks/snmp_uptime b/checks/snmp_uptime
index 2a0c96d..29fb679 100644
--- a/checks/snmp_uptime
+++ b/checks/snmp_uptime
@@ -33,7 +33,10 @@ def inventory_snmp_uptime(info):
 def check_snmp_uptime(checktype, params, info):
     ticks            = info[0][0]
     try:
-        uptime = int(ticks[:-2])
+        if len(ticks) < 3:
+            uptime = 0
+        else:
+            uptime = int(ticks[:-2])
     except:
         days, h, m, s = ticks.split(":")
         uptime = (int(days) * 86400 ) + (int(h) * 3600) + (int(m) * 60) + int(float(s))



More information about the checkmk-commits mailing list