Module: check_mk
Branch: master
Commit: f43f4b8662613f93f75ed929a99104e0f1fca427
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f43f4b8662613f…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue May 7 16:27:47 2013 +0200
winperf_processor: Now displays (and scales) to number of cpus in pnpgraph
---
ChangeLog | 1 +
checkman/winperf_processor.util | 25 +++++---
checks/winperf_processor | 3 +-
pnp-templates/check_mk-winperf_processor.util.php | 65 +--------------------
4 files changed, 20 insertions(+), 74 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 91a8996..28f415f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -93,6 +93,7 @@
* viprinet checks: New checks for firmware version/update, memory usage, power supply
status,
router mode, serialnumber and temperature sensors
* uptime, snmp_uptime, esx_vsphere_counters.uptime: allow to set lower and upper
levels
+ * winperf_processor: Now displays (and scales) to number of cpus in pnpgraph
Notifications:
* notify.py: unique spoolfiles name no longer created with uuid
diff --git a/checkman/winperf_processor.util b/checkman/winperf_processor.util
index bef6f38..774a4d1 100644
--- a/checkman/winperf_processor.util
+++ b/checkman/winperf_processor.util
@@ -10,22 +10,29 @@ description:
Setting a level for warning or a critical state is possible, but might
not be very usefull, since the computed value is an average over
- just one check cycle. A combination with a larger value of {max_check_attempts}
- or {notification_delay} might be useful here.
+ just one check cycle. Consider to set the {average} option for this purpose.
+ A combination with a larger value of {max_check_attempts}
+ or {notification_delay} might also be useful here.
perfdata:
- The averaged percentage of CPU utilization during the last check cycle.
+ One or two values: the first value is current usage in percent - ranging from
+ 0 to 100. The "maximum" value is not 100, but the number of CPU threads.
This
+ case be used for scaling the graph in terms of the number of used CPU threads.
+
+ If averaging is enabled then a second value is sent: the averaged CPU utilization
+ ranging from 0 to 100.
inventory:
A check of this type is automatically created for all Windows
hosts.
[parameters]
-warning (int): The percentage of CPU usage that triggers
- a WARNING state
-critical (int): The percentage of CPU usage that triggers
- a CRITICAL state
+parameters(dict): A dictionary with the following keys:
-[configuration]
-winperf_cpu_default_levels (int, int): Default levels warning and critical
+ {"levels"}: Either {None} for no levels, a tuple of warn and crit (in
percent) or
+ a dictionary with predictive levels settings.
+ {"average"}: A number of minutes for enabling averaging.
+
+[configuration]
+winperf_cpu_default_levels(dict): Default levels, preset to { "levels": (101.0,
101.0) }
diff --git a/checks/winperf_processor b/checks/winperf_processor
index 9c16d67..140ed02 100644
--- a/checks/winperf_processor
+++ b/checks/winperf_processor
@@ -25,7 +25,7 @@
# Boston, MA 02110-1301 USA.
-winperf_cpu_default_levels = ( 101.0, 101.0 )
+winperf_cpu_default_levels = { "levels": ( 101.0, 101.0 ) }
def inventory_winperf_util(info):
if len(info) <= 1:
@@ -71,6 +71,7 @@ def check_winperf_util(_no_item, params, info):
used_perc = 100
state, infotext, perfdata = check_cpu_util(used_perc, params, this_time)
+ perfdata[0] = perfdata[0][:5] + (num_cpus,)
infotext += ", %d CPUs" % num_cpus
return state, infotext, perfdata
diff --git a/pnp-templates/check_mk-winperf_processor.util.php
b/pnp-templates/check_mk-winperf_processor.util.php
deleted file mode 100644
index 1da3886..0000000
--- a/pnp-templates/check_mk-winperf_processor.util.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-# +------------------------------------------------------------------+
-# | ____ _ _ __ __ _ __ |
-# | / ___| |__ ___ ___| | __ | \/ | |/ / |
-# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
-# | | |___| | | | __/ (__| < | | | | . \ |
-# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
-# | |
-# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
-# +------------------------------------------------------------------+
-#
-# This file is part of Check_MK.
-# The official homepage is at
http://mathias-kettner.de/check_mk.
-#
-# check_mk is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation in version 2. check_mk is distributed
-# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
-# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE. See the GNU General Public License for more de-
-# ails. You should have received a copy of the GNU General Public
-# License along with GNU Make; see the file COPYING. If not, write
-# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-# Boston, MA 02110-1301 USA.
-
-# Do not depend on numbers, use names
-$RRD = array();
-foreach ($NAME as $i => $n) {
- $RRD[$n] = "$RRDFILE[$i]:$DS[$i]:MAX";
- $WARN[$n] = $WARN[$i];
- $CRIT[$n] = $CRIT[$i];
- $MIN[$n] = $MIN[$i];
- $MAX[$n] = $MAX[$i];
-}
-
-$desc = str_replace("_", " ", $servicedesc);
-$opt[1] = "--vertical-label 'CPU utilization %' -l0 -u 100 --title
\"$hostname - $desc\" ";
-
-$def[1] = "DEF:util=$RRD[util] ".
- "AREA:util#60f020:\"Utilization\:\" ".
- "LINE:util#40a018 ".
- "GPRINT:util:LAST:\"%4.1lf%%,\" ".
- "GPRINT:util:MIN:\"min\: %4.1lf%%,\" ".
- "GPRINT:util:MAX:\"max\: %4.1lf%%\\n\" ".
- "";
-
-if (isset($RRD["avg"])) {
- $def[1] .= "DEF:avg=$RRD[avg] ".
- "LINE:avg#000080:\"Averaged \" ".
- "GPRINT:avg:LAST:\"%4.1lf%%,\" ".
- "GPRINT:avg:MIN:\"min\: %4.1lf%%,\" ".
- "GPRINT:avg:MAX:\"max\: %4.1lf%%\\n\" ".
- "";
-}
-
-if ($WARN[1]) {
- $def[1] .=
- "HRULE:$WARN[1]#ffe000:\"Warning at $WARN[1]%\" ".
- "HRULE:$CRIT[1]#ff0000:\"Critical at $CRIT[1]%\\n\" ".
- "";
-}
-#
-
-?>
diff --git a/pnp-templates/check_mk-winperf_processor.util.php
b/pnp-templates/check_mk-winperf_processor.util.php
new file mode 120000
index 0000000..a7d9073
--- /dev/null
+++ b/pnp-templates/check_mk-winperf_processor.util.php
@@ -0,0 +1 @@
+check_mk-esx_vsphere_hostsystem.cpu_usage.php
\ No newline at end of file