Module: check_mk
Branch: master
Commit: bcf9401469bc2e805befa8d07e5dd3bc4f019129
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bcf9401469bc2e…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Wed Apr 4 13:29:32 2018 +0200
Remove unnecessary else in netapp_api_vf_stats
Change-Id: I8d2a3f9de5d82f0b86ab61df7d9296e33dbe429c
---
checks/netapp_api_vf_stats | 45 +++++++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/checks/netapp_api_vf_stats b/checks/netapp_api_vf_stats
index 7dc86fe..cab4717 100644
--- a/checks/netapp_api_vf_stats
+++ b/checks/netapp_api_vf_stats
@@ -29,41 +29,43 @@ netapp_api_vf_stats_cpu_util_default_levels = (90.0, 95.0)
# <<<netapp_api_vf_stats:sep(9)>>>
# vfiler vfiler0 instance_uuid node_uuid vfiler_cpu_busy 663312444303217
vfiler_net_data_sent 8204762 vfiler_read_ops 14334581 ...
+
def inventory_netapp_api_vf_stats(parsed):
for key in parsed.keys():
yield key, 'netapp_api_vf_stats_cpu_util_default_levels'
+
def check_netapp_api_vf_stats(item, params, parsed):
vf = parsed.get(item)
if not vf:
return
- else:
- now = time.time()
- cpu_busy = int(vf["vfiler_cpu_busy"])
- ticks_per_sec = get_rate("netapp_api_vf_stats.cpu_busy", now, cpu_busy,
onwrap=RAISE)
+ now = time.time()
- 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)
+ cpu_busy = int(vf["vfiler_cpu_busy"])
+ ticks_per_sec = get_rate("netapp_api_vf_stats.cpu_busy", now, cpu_busy,
onwrap=RAISE)
- if ticks_per_sec == 0:
- raise MKCounterWrapped("Counter wrapped")
+ 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)
- num_processors = float(vf.get("num_processors", 1))
+ if ticks_per_sec == 0:
+ raise MKCounterWrapped("Counter wrapped")
- used_perc = ticks_per_sec / num_processors / ticks_per_sec_base * 100
+ num_processors = float(vf.get("num_processors", 1))
- # Due to timeing invariancies the measured level can become > 100%.
- # This makes users unhappy, so cut it off.
- if used_perc < 0:
- used_perc = 0
- elif used_perc > 100:
- used_perc = 100
+ used_perc = ticks_per_sec / num_processors / ticks_per_sec_base * 100
- 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
+ # Due to timeing invariancies the measured level can become > 100%.
+ # This makes users unhappy, so cut it off.
+ if used_perc < 0:
+ used_perc = 0
+ elif used_perc > 100:
+ used_perc = 100
+
+ 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
check_info["netapp_api_vf_stats"] = {
@@ -81,6 +83,7 @@ def inventory_netapp_api_vf_stats_traffic(parsed):
for key in parsed.keys():
yield key, None
+
def check_netapp_api_vf_stats_traffic(item, params, parsed):
vf = parsed.get(item)
if not vf:
@@ -104,5 +107,3 @@ check_info["netapp_api_vf_stats.traffic"] = {
'has_perfdata' : True,
'service_description' : 'Traffic vFiler %s',
}
-
-