[checkmk-commits] 4707 FIX netapp_api_vf_stats: improved computation of CPU utilization, now showing number of processors

Andreas Boesl ab at mathias-kettner.de
Tue Jun 6 11:51:03 CEST 2017


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

Author: Andreas Boesl <ab at mathias-kettner.de>
Date:   Tue Jun  6 11:40:50 2017 +0200

4707 FIX netapp_api_vf_stats: improved computation of CPU utilization, now showing number of processors

Change-Id: I1294a41f11ab47f2aaf2d13b7b7eea4344ffc5f6

---

 .werks/4707                | 11 +++++++++++
 checks/netapp_api_vf_stats | 16 +++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/.werks/4707 b/.werks/4707
new file mode 100644
index 0000000..2b313cf
--- /dev/null
+++ b/.werks/4707
@@ -0,0 +1,11 @@
+Title: netapp_api_vf_stats: improved computation of CPU utilization, now showing number of processors
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1496741969
+
+
diff --git a/checks/netapp_api_vf_stats b/checks/netapp_api_vf_stats
index 27cc0fa..7dc86fe 100644
--- a/checks/netapp_api_vf_stats
+++ b/checks/netapp_api_vf_stats
@@ -41,9 +41,17 @@ def check_netapp_api_vf_stats(item, params, parsed):
         now = time.time()
 
         cpu_busy = int(vf["vfiler_cpu_busy"])
-        ticks_per_sec = get_rate("netapp_api_vf_stats.cpu_util.%s" % item, now, cpu_busy, onwrap=RAISE)
-        cpusecs_per_sec = ticks_per_sec / 1000.0 / 1000 / 10000
-        used_perc = 100.0 * cpusecs_per_sec
+        ticks_per_sec = get_rate("netapp_api_vf_stats.cpu_busy", now, cpu_busy, onwrap=RAISE)
+
+        cpu_busy_base = int(vf["vfiler_cpu_busy_base"])
+        ticks_per_sec_base = get_rate("netapp_api_vf_stats.cpu_busy_base", now, cpu_busy_base, onwrap=RAISE)
+
+        if ticks_per_sec == 0:
+            raise MKCounterWrapped("Counter wrapped")
+
+        num_processors = float(vf.get("num_processors", 1))
+
+        used_perc = ticks_per_sec / num_processors / ticks_per_sec_base * 100
 
         # Due to timeing invariancies the measured level can become > 100%.
         # This makes users unhappy, so cut it off.
@@ -54,6 +62,7 @@ def check_netapp_api_vf_stats(item, params, parsed):
 
         state, infotext, perfdata = check_cpu_util(used_perc, params, now).next()
         perfdata[0] = perfdata[0][:5]
+        infotext += ", Num Processors: %d" % num_processors
         return state, infotext, perfdata
 
 
@@ -96,3 +105,4 @@ check_info["netapp_api_vf_stats.traffic"] = {
     'service_description' : 'Traffic vFiler %s',
 }
 
+



More information about the checkmk-commits mailing list