Module: check_mk
Branch: master
Commit: 9bd941fc9957b761332203f8830cb957f7d97cf5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9bd941fc9957b7…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jul 20 15:51:48 2012 +0200
vms_cpu: new check for CPU utilization on OpenVMS
---
ChangeLog | 1 +
checkman/vms_cpu | 28 +++++++++++++++
checks/vms_cpu | 66 ++++++++++++++++++++++++++++++++++++
pnp-templates/check_mk-vms_cpu.php | 1 +
web/plugins/perfometer/check_mk.py | 1 +
5 files changed, 97 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 413d8c9..896a24e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@
* vms_diskstat.df: new check file usage of OpenVMS disks (agent will
come shortly after)
* vms_users: new check for number of interactive sessions on OpenVMS
+ * vms_cpu: new check for CPU utilization on OpenVMS
WATO:
* Added permission to control the "clone host" feature in WATO
diff --git a/checkman/vms_cpu b/checkman/vms_cpu
new file mode 100644
index 0000000..0880cf1
--- /dev/null
+++ b/checkman/vms_cpu
@@ -0,0 +1,28 @@
+title: Check CPU utilization (usage) and IO-Wait
+agents: openvms
+author: Mathias Kettner <mk(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ Check CPU utilization (user, system, idle) and IO-Wait on an
+ OpenVMS system. The number of CPUs is taken into account so that
+ maximum percentage is 100% is refers to the total CPUs available.
+
+ A level can be set only on {wait} (disk wait).
+
+perfdata:
+ Three variables: The percentage of time spent in {user}, {system} and {wait}
+ (disk wait). The idle time can be computed by substracting those three values
+ from 100%. The user value contains also {nice}.
+
+inventory:
+ One check per host is created for OpenVMS systems.
+
+[parameters]
+warning (int): The percentage of {wait} that triggers a warning level.
+critical (int): The percentage of {wait} that triggers a critical level
+ The parameters may also be set to {None}, which makes the check alwas {OK}.
+
+[configuration]
+vms_cpu_default_levels (int, int): Default levels used by inventorized
+ checks. This is present to {None}, which disables the levels.
diff --git a/checks/vms_cpu b/checks/vms_cpu
new file mode 100644
index 0000000..9e2b862
--- /dev/null
+++ b/checks/vms_cpu
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2012 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.
+
+vms_cpu_default_levels = None
+
+# Example output from agent:
+# <<<vms_cpu>>>
+# 1 99.17 0.54 0.18 0.00
+
+
+def inventory_vms_cpu(info):
+ if len(info) > 0:
+ return [(None, "vms_cpu_default_levels")]
+
+def check_vms_cpu(item, params, info):
+ num_cpus = int(info[0][0])
+ idle, user, wait_interrupt, wait_npsync = map(lambda x: float(x) / num_cpus,
info[0][1:])
+ wait = wait_interrupt + wait_npsync
+ system = 100.0 - idle - user - wait
+ infotext = " - user: %2.1f%%, system: %2.1f%%, wait: %2.1f%%" % (user,
system, wait)
+ state = 0
+ if params:
+ warn, crit = params
+ if wait >= crit:
+ state = 2
+ infotext += '(!!)'
+ elif wait >= warn:
+ state = 1
+ infotext += '(!)'
+
+ perfdata = [
+ ( "user", user ),
+ ( "system", system ),
+ ( "wait", wait, warn, crit ) ]
+ return (state, nagios_state_names[state] + infotext, perfdata)
+
+check_info['vms_cpu'] = {
+ "check_function" : check_vms_cpu,
+ "inventory_function" : inventory_vms_cpu,
+ "service_description" : "CPU utilization",
+ "has_perfdata" : True,
+ "group" : "cpu_iowait",
+}
diff --git a/pnp-templates/check_mk-vms_cpu.php b/pnp-templates/check_mk-vms_cpu.php
new file mode 120000
index 0000000..16648b1
--- /dev/null
+++ b/pnp-templates/check_mk-vms_cpu.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 05dad5b..1faf690 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -84,6 +84,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-vms_cpu"] = 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