Module: check_mk
Branch: master
Commit: b651154d13dff03c7f24be105de8325a9d3ff9a7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b651154d13dff0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 9 15:32:34 2013 +0100
FIX: winperf_processor: Showing 0% on "cmk -nv" now instead of 100%
---
ChangeLog | 1 +
checks/winperf_processor | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8aa6373..778c06e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,7 @@
* FIX: zpool_status: fixed crash when spare devices were available
* FIX: hr_fs: handle negative values in order to larger disks (thanks to Christof
Musik)
* FIX: mssql_backup: Fixed wrong calculation of backup age in seconds
+ * FIX: winperf_processor: Showing 0% on "cmk -nv" now instead of 100%
* New script multisite_to_mrpe for exporting services from a remote system
diff --git a/checks/winperf_processor b/checks/winperf_processor
index d2e7d5b..b9ffb27 100644
--- a/checks/winperf_processor
+++ b/checks/winperf_processor
@@ -50,8 +50,11 @@ def check_winperf_util(item, params, info):
ticks = int(line[-2])
num_cpus = len(line) - 3
timedif, ticks_per_sec = get_counter("winperf_util", this_time,
ticks)
- secs_per_sec = ticks_per_sec / 10000000.0;
- used_perc = 100 * (1 - secs_per_sec)
+ if ticks_per_sec == 0.0:
+ used_perc = 0.0
+ else:
+ cpusecs_per_sec = ticks_per_sec / 10000000.0
+ used_perc = 100 * (1 - cpusecs_per_sec)
if used_perc < 0:
used_perc = 0