Module: check_mk
Branch: master
Commit: a471340733352dc32b77ee5b930509fc163ece3c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a471340733352d…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Wed Jan 11 11:08:18 2017 +0100
4211 FIX esx_vsphere_counters: No longer crash when counters are available for instances
without a read value
Change-Id: Ida3f53e22a83b47cabaeeb3ca707ffc41b2ca46d
---
.werks/4211 | 10 ++++++++++
ChangeLog | 1 +
checks/esx_vsphere_counters | 6 ++++--
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/.werks/4211 b/.werks/4211
new file mode 100644
index 0000000..73bad8f
--- /dev/null
+++ b/.werks/4211
@@ -0,0 +1,10 @@
+Title: esx_vsphere_counters: No longer crash when counters are available for instances
without a read value
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i4
+Date: 1484129178
+
+
diff --git a/ChangeLog b/ChangeLog
index ae331d4..a970a2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,7 @@
* 4262 FIX: wmi_cpuload: fixed missing section handling...
* 4263 FIX: oracle_crs_res: fixed UnboundLocalError; 'crs_nodename'
referenced before assignment...
* 4264 FIX: wmic_process: fixed invalid info handling
+ * 4211 FIX: esx_vsphere_counters: No longer crash when counters are available for
instances without a read value
Multisite:
* 4169 View action: Default values of sticky, notification and persistent options can
now be configured via global settings....
diff --git a/checks/esx_vsphere_counters b/checks/esx_vsphere_counters
index 8b23ffa..dd4601c 100644
--- a/checks/esx_vsphere_counters
+++ b/checks/esx_vsphere_counters
@@ -146,11 +146,13 @@ def esx_vsphere_get_average(values):
int_values = map(int, values)
return sum(int_values) / float(len(int_values))
+
# esx datastores are either shown by human readable name (if available) or by the uid
def esx_vsphere_counters_get_item_mapping(parsed):
map_instance_to_item = {}
- for instance in parsed.get("datastore.read", {}).keys():
- map_instance_to_item[instance] = instance
+ for counter in [ "read", "write", "datastoreReadIops",
"datastoreWriteIops", "sizeNormalizedDatstoreLatency" ]:
+ for instance in parsed.get("datastore." + counter, {}).keys():
+ map_instance_to_item[instance] = instance
for instance, values in parsed.get("datastore.name", {}).items():
if instance in map_instance_to_item and values[0][0] != "":