Module: check_mk
Branch: master
Commit: 0e632d999de493739b4ddc2f467e5c0f8bed5a46
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0e632d999de493…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Mon Jun 8 17:33:46 2015 +0200
#2219 hr_cpu: Reworked check to use WATO rule allowing averaging and predictive levels
hr_cpu now uses a different WATO rule, so old rules for this check type will no longer
apply.
---
.werks/2219 | 10 ++++++++++
ChangeLog | 2 ++
checks/cpu_util.include | 6 +++---
checks/hr_cpu | 17 +++++------------
web/plugins/wato/check_parameters.py | 5 +++--
5 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/.werks/2219 b/.werks/2219
new file mode 100644
index 0000000..83e5cf3
--- /dev/null
+++ b/.werks/2219
@@ -0,0 +1,10 @@
+Title: hr_cpu: Reworked check to use WATO rule allowing averaging and predictive levels
+Level: 1
+Component: checks
+Compatible: incomp
+Version: 1.2.7i2
+Date: 1433777551
+Class: feature
+
+hr_cpu now uses a different WATO rule, so old rules for this check type will no longer
+apply.
diff --git a/ChangeLog b/ChangeLog
index 9b49e30..576dd0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@
* 2325 oracle_tablespaces: correctly handle case where check runs in clustered
mode...
* 2216 raritan_pdu_ocprot: New check to monitor overcurrent protectors of Raritan
PDUs...
* 2119 omd_status: check can now work in a cluster environment
+ * 2219 hr_cpu: Reworked check to use WATO rule allowing averaging and predictive
levels...
+ NOTE: Please refer to the migration notes!
* 2323 FIX: df: Fix new graphs for all filesystem checks in case of existing inode
information
* 2305 FIX: agent_vsphere, esx_vsphere_sensors: now able to handle sensor names with
semicolon...
* 2118 FIX: aix_sap_processlist: agent plugin now is more general to deal with
various AIX versions...
diff --git a/checks/cpu_util.include b/checks/cpu_util.include
index 5aa4f98..30f5cca 100644
--- a/checks/cpu_util.include
+++ b/checks/cpu_util.include
@@ -53,11 +53,11 @@ def check_cpu_util(util, params, this_time = None):
if "average" in params:
util_avg = get_average("cpu_utilization.avg", this_time, util,
params["average"])
check_against = util_avg
- counter = "avg"
+ perfvar = "avg"
infotext += ", %dmin average: %.1f %%" % (params["average"],
util_avg)
else:
check_against = util
- counter = "util"
+ perfvar = "util"
levels = params.get("levels")
@@ -66,7 +66,7 @@ def check_cpu_util(util, params, this_time = None):
else:
warn, crit = None, None
- state, extrainfo, extraperf = check_levels(check_against, counter, levels)
+ state, extrainfo, extraperf = check_levels(check_against, perfvar, levels)
if extrainfo:
infotext += ", " + extrainfo
diff --git a/checks/hr_cpu b/checks/hr_cpu
index 30fa1f1..a3bc6a5 100644
--- a/checks/hr_cpu
+++ b/checks/hr_cpu
@@ -29,24 +29,16 @@ def inventory_hr_cpu(info):
if len(info) >= 1:
return [(None, "hr_cpu_default_levels")]
-def check_hr_cpu(item, params, info):
+def check_hr_cpu(_no_item, params, info):
num_cpus = 0
util = 0
for line in info:
util += int(line[0])
num_cpus += 1
if num_cpus == 0:
- return (3, "no data found in SNMP output")
+ return 3, "No data found in SNMP output"
util = float(util) / num_cpus
- infotext = "%2.1f%% utilization at %d CPUs" % (util, num_cpus)
- warn, crit = params
- perfdata = [("util", util, warn, crit, 0, 100)]
- if util >= crit:
- return (2, infotext + " (critical at %d%%)" % crit, perfdata)
- elif util >= warn:
- return (1, infotext + " (warning at %d%%)" % warn, perfdata)
- else:
- return (0, infotext, perfdata)
+ return check_cpu_util(util, params)
# HOST-RESOURCES-MIB::hrSystemUptime.0
@@ -61,5 +53,6 @@ check_info["hr_cpu"] = {
not not oid('.1.3.6.1.2.1.25.1.1.0') and not \
("linux" in oid(".1.3.6.1.2.1.1.1.0").lower()
and oid(".1.3.6.1.4.1.2021.10.1.6.1")),
- 'group': 'cpu_utilization',
+ 'group': 'cpu_utilization_os',
+ 'includes': [ 'cpu_util.include' ],
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index df7cc4a..244dad2 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3885,10 +3885,11 @@ register_check_parameters(
register_check_parameters(
subgroup_os,
"cpu_utilization_os",
- _("CPU utilization for Windows and ESX Hosts"),
+ _("CPU utilization for simple devices"),
Dictionary(
help = _("This rule configures levels for the CPU utilization (not load) for
"
- "the operating systems Windows and VMWare ESX host systems. The
utilization "
+ "the operating systems Windows and VMWare ESX host systems, as well
as devices "
+ "implementing the Host Resources MIB. The utilization "
"ranges from 0 to 100 - regardless of the number of CPUs."),
elements = [
( "levels",