using section lparstat_aix)
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 7f88d4b3c9edc06b65dc8a2043b5ea8509ef27c1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7f88d4b3c9edc0…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed May 23 16:49:22 2012 +0200
AIX: new check for CPU utilization (using section lparstat_aix)
---
ChangeLog | 1 +
checks/kernel | 13 ++++--
checks/lparstat_aix | 47 +++++++++++++++++++++-
pnp-templates/check_mk-lparstat_aix.cpu_util.php | 1 +
web/plugins/perfometer/check_mk.py | 1 +
5 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a7d908a..fd1ad12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@
Checks & Agents:
* AIX: convert NIC check to lnx_if (now being compatible with if/if64)
+ * AIX: new check for CPU utilization (using section lparstat_aix)
1.2.0b4:
Core:
diff --git a/checks/kernel b/checks/kernel
index 2102d27..2996bb2 100644
--- a/checks/kernel
+++ b/checks/kernel
@@ -135,21 +135,24 @@ def check_cpu_utilization(item, params, info):
( "system", "%.3f" % system_perc ),
( "wait", "%.3f" % wait_perc ) ]
+ infotext = " - user: %2.1f%%, system: %2.1f%%, wait: %2.1f%%" % (user_perc,
system_perc, wait_perc)
+
# You may set a warning/critical level on the io wait
# percentage. This can be done by setting params to
# a pair of (warn, crit)
- result = (0, "OK")
+ result = 0
try:
warn, crit = params
if wait_perc >= crit:
- result = (2, "CRIT (wait too large)")
+ result = 2
+ infotext += "(!!)"
elif wait_perc >= warn:
- result = (1, "WARNING (wait too large)")
+ result = 1
+ infotext += "(!)"
except:
pass
- return (result[0], result[1] + " - user: %2.1f%%, system: %2.1f%%, wait:
%2.1f%%" %
- (user_perc, system_perc, wait_perc), perfdata)
+ return (result, nagios_state_names[result] + infotext, perfdata)
check_info['kernel.util'] = (check_cpu_utilization, "CPU utilization",
1, inventory_cpu_utilization)
checkgroup_of['kernel.util'] = "cpu_iowait"
diff --git a/checks/lparstat_aix b/checks/lparstat_aix
index 85799e4..514cd1f 100644
--- a/checks/lparstat_aix
+++ b/checks/lparstat_aix
@@ -52,7 +52,7 @@ def check_lparstat(item, params, info):
lbusy = info[0][6]
app = info[0][7]
except:
- return (3, "Unknown - invalid or incomplete output from plugin")
+ return (3, "UNKNOWN - invalid or incomplete output from plugin")
perfdata = [
('user', str(user) + '%'),
@@ -65,6 +65,49 @@ def check_lparstat(item, params, info):
('app', str(app) + ''),
]
- return (0, "OK: AIX lparstat, user=%s%% sys=%s%% wait=%s%% idle=%s%% physc=%s
app=%s" % (user,sys,wait,idle,physc,app),perfdata )
+ return (0, "OK - AIX lparstat, user=%s%% sys=%s%% wait=%s%% idle=%s%% physc=%s
app=%s" % (user,sys,wait,idle,physc,app),perfdata )
check_info['lparstat_aix'] = (check_lparstat, "lparstat", 1,
inventory_lparstat )
+
+# Utilization and IO/Wait
+kernel_util_default_levels = None
+
+def inventory_lparstat_aix_cpu(info):
+ if len(info) == 1 and len(info[0]) >= 4:
+ return [(None, "kernel_util_default_levels")]
+
+def check_lparstat_aix_cpu(_no_item, params, info):
+ user, system, wait, idle = map(float, info[0][:4])
+ perfdata = [
+ ( "user", "%.3f" % user ),
+ ( "system", "%.3f" % system ),
+ ( "wait", "%.3f" % wait ) ]
+
+ infotext = " - user: %2.1f%%, system: %2.1f%%, wait: %2.1f%%" % (user,
system, wait)
+
+ # You may set a warning/critical level on the io wait
+ # percentage. This can be done by setting params to
+ # a pair of (warn, crit)
+ result = 0
+ try:
+ warn, crit = params
+ if wait >= crit:
+ result = 2
+ infotext += "(!!)"
+ elif wait >= warn:
+ result = 1
+ infotext += "(!)"
+ except:
+ pass
+
+ return (result, nagios_state_names[result] + infotext, perfdata)
+
+
+
+check_info['lparstat_aix.cpu_util'] = {
+ "check_function" : check_lparstat_aix_cpu,
+ "inventory_function" : inventory_lparstat_aix_cpu,
+ "service_description" : "CPU utilization",
+ "has_perfdata" : True,
+ "group" : "cpu_iowait",
+}
diff --git a/pnp-templates/check_mk-lparstat_aix.cpu_util.php
b/pnp-templates/check_mk-lparstat_aix.cpu_util.php
new file mode 120000
index 0000000..16648b1
--- /dev/null
+++ b/pnp-templates/check_mk-lparstat_aix.cpu_util.php
@@ -0,0 +1 @@
+check_mk-kernel.util.php
\ No newline at end of file
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 9004877..b6bda11 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -83,6 +83,7 @@ def perfometer_check_mk_kernel_util(row, check_command, perf_data):
perfometers["check_mk-kernel.util"] = perfometer_check_mk_kernel_util
perfometers["check_mk-vms_sys.util"] = perfometer_check_mk_kernel_util
perfometers["check_mk-ucd_cpu_util"] = perfometer_check_mk_kernel_util
+perfometers["check_mk-lparstat_aix.cpu_util"] =
perfometer_check_mk_kernel_util
def perfometer_check_mk_mem_used(row, check_command, perf_data):
h = '<table><tr>'