Module: check_mk
Branch: master
Commit: 0d1a517f4f353bb6a4d2557639d4cfb9382270a0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0d1a517f4f353b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Aug 2 16:58:54 2016 +0200
3734 FIX esx_vsphere_hostsystem.cpu_usage esx_vsphere_hostsystem.mem_usage
esx_vsphere_hostsystem.maintenance: Fixed exception when needed data is missing
---
.werks/3734 | 9 +++++++++
ChangeLog | 1 +
checks/esx_vsphere_hostsystem | 12 ++++++++++++
3 files changed, 22 insertions(+)
diff --git a/.werks/3734 b/.werks/3734
new file mode 100644
index 0000000..ded1cf0
--- /dev/null
+++ b/.werks/3734
@@ -0,0 +1,9 @@
+Title: esx_vsphere_hostsystem.cpu_usage esx_vsphere_hostsystem.mem_usage
esx_vsphere_hostsystem.maintenance: Fixed exception when needed data is missing
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i1
+Date: 1470149835
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index a58b579..345e837 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -324,6 +324,7 @@
* 3731 FIX: sap.value-groups: Replaced this check with sap.value_groups...
* 3742 FIX: ps: Fixed broken averaging...
* 3711 FIX: ipmi: fixed wrong status handling if sensor status is ok but failures
detected
+ * 3734 FIX: esx_vsphere_hostsystem.cpu_usage esx_vsphere_hostsystem.mem_usage
esx_vsphere_hostsystem.maintenance: Fixed exception when needed 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 2b1688d..4a29001 100644
--- a/checks/esx_vsphere_hostsystem
+++ b/checks/esx_vsphere_hostsystem
@@ -59,6 +59,10 @@ def inventory_esx_vsphere_hostsystem_cpu(info):
def check_esx_vsphere_hostsystem_cpu(item, params, info):
data = esx_vsphere_hostsystem_convert(info)
+
+ if "summary.quickStats.overallCpuUsage" not in data:
+ return
+
num_sockets = int(data['hardware.cpuInfo.numCpuPackages'][0])
num_cores = int(data['hardware.cpuInfo.numCpuCores'][0])
num_threads = int(data['hardware.cpuInfo.numCpuThreads'][0])
@@ -249,6 +253,10 @@ def inventory_esx_vsphere_hostsystem_mem(info):
def check_esx_vsphere_hostsystem_mem(item, params, info):
data = esx_vsphere_hostsystem_convert(info)
+
+ if "summary.quickStats.overallMemoryUsage" not in data:
+ return
+
memory_usage = savefloat(data['summary.quickStats.overallMemoryUsage'][0]) *
1024 * 1024
memory_size = savefloat(data['hardware.memorySize'][0])
level = memory_usage / memory_size * 100
@@ -341,6 +349,10 @@ def inventory_esx_vsphere_hostsystem_maintenance(info):
def check_esx_vsphere_hostsystem_maintenance(_no_item, params, info):
data = esx_vsphere_hostsystem_convert(info)
target_state = params['target_state']
+
+ if "runtime.inMaintenanceMode" not in data:
+ return
+
current_state = str(data['runtime.inMaintenanceMode'][0]).lower()
state = 0
if target_state != current_state: