Module: check_mk
Branch: master
Commit: 6d57ef82922b456f5843a4c7c69dfd7f50d820e3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6d57ef82922b45…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Jun 7 10:02:19 2016 +0200
3541 FIX esx_vsphere_hostsystem.state: no longer crashes when data is missing
Sometimes ESX systems decide not report any data at all.
This check no longer crashes when this happens, it simply reports UNKNOWN.
An upcoming update will change this behaviour so that the checks will go stale
in case the data is missing.
---
.werks/3541 | 15 +++++++++++++++
ChangeLog | 1 +
checks/esx_vsphere_hostsystem | 3 +++
3 files changed, 19 insertions(+)
diff --git a/.werks/3541 b/.werks/3541
new file mode 100644
index 0000000..8485117
--- /dev/null
+++ b/.werks/3541
@@ -0,0 +1,15 @@
+Title: esx_vsphere_hostsystem.state: no longer crashes when data is missing
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1465286242
+
+Sometimes ESX systems decide not report any data at all.
+This check no longer crashes when this happens, it simply reports UNKNOWN.
+
+An upcoming update will change this behaviour so that the checks will go stale
+in case the data is missing.
+
diff --git a/ChangeLog b/ChangeLog
index e3e8e5c..9fcc98d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -260,6 +260,7 @@
* 2238 FIX: postfix_mailq: Fixed incorrect creation of RRDs, Fixed graphs of size and
length of queues...
* 3633 FIX: check_sql: minor cleanup in active check_sql, fixed performance data
handling
* 3540 FIX: Fixed exception on reading cachefiles...
+ * 3541 FIX: esx_vsphere_hostsystem.state: no longer crashes when data is missing...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/esx_vsphere_hostsystem b/checks/esx_vsphere_hostsystem
index 11fbf4a..3e88dd5 100644
--- a/checks/esx_vsphere_hostsystem
+++ b/checks/esx_vsphere_hostsystem
@@ -295,6 +295,9 @@ def inventory_esx_vsphere_hostsystem_state(info):
def check_esx_vsphere_hostsystem_state(_no_item, _no_params, info):
data = esx_vsphere_hostsystem_convert(info)
state = 0
+ if "overallStatus" not in data:
+ return
+
overallStatus = str(data['overallStatus'][0])
if overallStatus == "yellow":
state = 1