[checkmk-commits] Check_MK Git: check_mk: #1102 FIX esx_vsphere_counters: now raise a MKCounterWrapped exception if counter data is missing

Andreas Boesl ab at mathias-kettner.de
Thu Aug 28 09:56:00 CEST 2014


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

Author: Andreas Boesl <ab at mathias-kettner.de>
Date:   Thu Aug 28 09:55:40 2014 +0200

#1102 FIX esx_vsphere_counters: now raise a MKCounterWrapped exception if counter data is missing

Sometimes the ESX Host does not report valid counter ids.<br>
It may look like <br>

<pre>
<id>
  <counterId>-2147483645</counterId>
  <instance>84</instance>
</id>
<pre>

If this happens the <tt><<<esx_vsphere_counters>>></tt> section in the agent is empty.
Any checks which relied on this section are now able to handle this scenario by raising a MKCounterWrappedException.
Therefore these checks will no longer go UNKNOWN, but stale...

---

 .werks/1102                 |   21 +++++++++++++++++++++
 ChangeLog                   |    1 +
 checks/esx_vsphere_counters |   11 ++++++++++-
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/.werks/1102 b/.werks/1102
new file mode 100644
index 0000000..3c24245
--- /dev/null
+++ b/.werks/1102
@@ -0,0 +1,21 @@
+Title: esx_vsphere_counters: now raise a MKCounterWrapped exception if counter data is missing
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1409212163
+Class: fix
+
+Sometimes the ESX Host does not report valid counter ids.<br>
+It may look like <br>
+
+<pre>
+<id>
+  <counterId>-2147483645</counterId>
+  <instance>84</instance>
+</id>
+<pre>
+
+If this happens the <tt><<<esx_vsphere_counters>>></tt> section in the agent is empty.
+Any checks which relied on this section are now able to handle this scenario by raising a MKCounterWrappedException.
+Therefore these checks will no longer go UNKNOWN, but stale...
diff --git a/ChangeLog b/ChangeLog
index d7975a8..86d761b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -62,6 +62,7 @@
     * 1099 FIX: tsm_scratch: now returns the variable name instead the values during inventory...
     * 0650 FIX: f5_bigip_pool: limits to the number of active nodes are now correctly applied...
             NOTE: Please refer to the migration notes!
+    * 1102 FIX: esx_vsphere_counters: now raise a MKCounterWrapped exception if counter data is missing...
 
     Multisite:
     * 1066 Implemented Dashboard Designer...
diff --git a/checks/esx_vsphere_counters b/checks/esx_vsphere_counters
index 641a420..70564dc 100644
--- a/checks/esx_vsphere_counters
+++ b/checks/esx_vsphere_counters
@@ -76,7 +76,7 @@ def inventory_esx_vsphere_counters_diskio(info):
 
 def check_esx_vsphere_counters_diskio(_no_item, _no_params, info):
     if not info:
-        return 3, "Counter data is missing"
+        raise MKCounterWrapped(None, "Counter data is missing")
 
     read_bytes  = 0
     write_bytes = 0
@@ -236,6 +236,9 @@ def inventory_esx_vsphere_counters_if(info):
     return inventory_if_common(converted)
 
 def check_esx_vsphere_counters_if(item, params, info):
+    if not info:
+        raise MKCounterWrapped(None, "Counter data is missing")
+
     converted = convert_esx_counters_if(info)
     return check_if_common(item, params, converted)
 
@@ -265,6 +268,9 @@ def inventory_esx_vsphere_counters_uptime(info):
             return [ (None, {}) ]
 
 def check_esx_vsphere_counters_uptime(_no_item, params, info):
+    if not info:
+        raise MKCounterWrapped(None, "Counter data is missing")
+
     for name, instance, counter, unit in info:
         if name == "sys.uptime":
             return check_uptime_seconds(params, int(counter))
@@ -314,6 +320,9 @@ def inventory_esx_vsphere_counters_ramdisk(info):
     return df_inventory(ramdisks)
 
 def check_esx_vsphere_counters_ramdisk(item, params, info):
+    if not info:
+        raise MKCounterWrapped(None, "Counter data is missing")
+
     ramdisks = []
     for name, instance, counter, unit in info:
         if name == 'sys.resourceMemConsumed' \



More information about the checkmk-commits mailing list