Module: check_mk
Branch: master
Commit: 29076d7fb254bba800a7afcebc250a12abd282eb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=29076d7fb254bb…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Oct 28 11:39:30 2016 +0200
3986 FIX esx_vsphere_counters.uptime: fixed incorrect alert when receiving corrupted
counter data
The check reported a negative uptime.
---
.werks/3986 | 9 +++++++++
ChangeLog | 1 +
checks/esx_vsphere_counters | 6 ++++--
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/.werks/3986 b/.werks/3986
new file mode 100644
index 0000000..25d4471
--- /dev/null
+++ b/.werks/3986
@@ -0,0 +1,9 @@
+Title: esx_vsphere_counters.uptime: fixed incorrect alert when receiving corrupted
counter data
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i2
+Date: 1477647498
+Class: fix
+
+The check reported a negative uptime.
diff --git a/ChangeLog b/ChangeLog
index 0450755..964d617 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -45,6 +45,7 @@
* 3985 FIX: mrpe: fixed broken long output when using the CMC...
* 4035 FIX: df_zos: Fixed ignoring last filesystem after new discovery...
* 3741 FIX: omd_status: Fix labelling and structure of several metric graphs
+ * 3986 FIX: esx_vsphere_counters.uptime: fixed incorrect alert when receiving
corrupted counter data...
Multisite:
* 3959 Two new filters for the comment view: author and comment text field
diff --git a/checks/esx_vsphere_counters b/checks/esx_vsphere_counters
index f911c1a..8b23ffa 100644
--- a/checks/esx_vsphere_counters
+++ b/checks/esx_vsphere_counters
@@ -368,8 +368,10 @@ def inventory_esx_vsphere_counters_uptime(parsed):
def check_esx_vsphere_counters_uptime(_no_item, params, parsed):
if "sys.uptime" not in parsed:
raise MKCounterWrapped("Counter data is missing")
-
- return check_uptime_seconds(params,
int(parsed["sys.uptime"][""][0][0][-1]))
+ uptime = int(parsed["sys.uptime"][""][0][0][-1])
+ if uptime < 0:
+ raise MKCounterWrapped("Counter data is corrupt")
+ return check_uptime_seconds(params, uptime)
check_info['esx_vsphere_counters.uptime'] = {