Module: check_mk
Branch: master
Commit: fd8fade11cb066891e9d1c780eb4927a87ca1f4e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fd8fade11cb066…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 22 14:48:49 2013 +0100
winperf_processor now outputs float usage instead of integer
---
ChangeLog | 1 +
checks/winperf_processor | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0fef4f9..d2d0f0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
Checks & Agents:
+ * winperf_processor now outputs float usage instead of integer
* FIX: mssql_counters.file_sizes - Fixed wrong value for "Log Files" in
output
* FIX: drbd: Parameters for expected roles and disk states can now be set to
None to disable alerting on changed values
diff --git a/checks/winperf_processor b/checks/winperf_processor
index 01231e4..a64f131 100644
--- a/checks/winperf_processor
+++ b/checks/winperf_processor
@@ -53,8 +53,15 @@ def check_winperf_util(item, params, info):
if ticks_per_sec == 0.0:
used_perc = 0.0
else:
+ # We get the value of the PERF_100NSEC_TIMER_INV here.
+ # This counter type shows the average percentage of active time observed
+ # during the sample interval. This is an inverse counter. Counters of
this
+ # type calculate active time by measuring the time that the service was
+ # inactive and then subtracting the percentage of active time from 100
percent.
+ #
+ # 1 tick = 100ns, convert to seconds
cpusecs_per_sec = ticks_per_sec / 10000000.0
- used_perc = 100 * (1 - cpusecs_per_sec)
+ used_perc = (100.0 * num_cpus) * (1 - cpusecs_per_sec)
if used_perc < 0:
used_perc = 0
@@ -70,7 +77,7 @@ def check_winperf_util(item, params, info):
else:
num_txt = " / %d CPUs" % num_cpus
- infotext = " - %d%% used%s (in last %d secs)" % (int(used_perc),
num_txt, timedif)
+ infotext = " - %0.2f%% used%s (in last %d secs)" % (used_perc,
num_txt, timedif)
if crit != None and used_perc >= crit:
return (2, "CRIT" + infotext, perfdata)