[checkmk-commits] 4909 FIX arris_cmts_cpu: Fixed crash if thresholds are set

Marcel Arentz ma at mathias-kettner.de
Mon Jun 26 18:01:15 CEST 2017


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

Author: Marcel Arentz <ma at mathias-kettner.de>
Date:   Mon Jun 26 17:57:50 2017 +0200

4909 FIX arris_cmts_cpu: Fixed crash if thresholds are set

Change-Id: I1bf072efef0c128c5b6afa23dc9d4ba3f9ac6886

---

 .werks/4909           | 10 ++++++++++
 checks/arris_cmts_cpu |  6 +++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/.werks/4909 b/.werks/4909
new file mode 100644
index 0000000..2c0b0de
--- /dev/null
+++ b/.werks/4909
@@ -0,0 +1,10 @@
+Title: arris_cmts_cpu: Fixed crash if thresholds are set
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1498492632
+Class: fix
+
+
diff --git a/checks/arris_cmts_cpu b/checks/arris_cmts_cpu
index 8323953..5da3238 100644
--- a/checks/arris_cmts_cpu
+++ b/checks/arris_cmts_cpu
@@ -38,6 +38,9 @@ def inventory_arris_cmts_cpu(info):
             yield item, 'arris_cmts_cpu_default_levels'
 
 def check_arris_cmts_cpu(item, params, info):
+    if type(params) is tuple:
+        params = { "levels" : params, }
+
     for oid_id, cpu_id, cpu_idle_util in info:
         # see inventory function
         if cpu_id:
@@ -48,7 +51,8 @@ def check_arris_cmts_cpu(item, params, info):
         if citem == item:
             # We get the IDLE percentage, but need the usage
             cpu_util = 100 - int(cpu_idle_util)
-            warn, crit = params
+            warn, crit = params['levels']
+
             infotext = "Current utilization is: %d %% " % cpu_util
             levels = " (warn/crit at %.1f/%.1f %%)" % (warn, crit)
             perfdata = [ ( "util", cpu_util, warn, crit ) ]



More information about the checkmk-commits mailing list