Module: check_mk
Branch: master
Commit: 7b24326fc2a2eca9f9c5f419558ee76a15f89578
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7b24326fc2a2ec…
Author: Florian Heigl <fh(a)mathias-kettner.de>
Date: Fri Jul 13 18:20:50 2012 +0200
hpux_tunables: Pretty Perf-O-Meters and PNP-Graphs for kernel tunable statistics from
HP-UX systems
---
checks/hpux_tunables | 5 +-
.../check_mk-hpux_tunables.maxfiles_lim.php | 1 +
pnp-templates/check_mk-hpux_tunables.nkthread.php | 1 +
pnp-templates/check_mk-hpux_tunables.nproc.php | 1 +
pnp-templates/check_mk-hpux_tunables.php | 50 ++++++++++++++++++++
pnp-templates/check_mk-hpux_tunables.semmni.php | 1 +
pnp-templates/check_mk-hpux_tunables.semmns.php | 1 +
pnp-templates/check_mk-hpux_tunables.shmseg.php | 1 +
web/plugins/perfometer/check_mk.py | 42 ++++++++++++++++
9 files changed, 101 insertions(+), 2 deletions(-)
diff --git a/checks/hpux_tunables b/checks/hpux_tunables
index c0acc76..8a79f12 100644
--- a/checks/hpux_tunables
+++ b/checks/hpux_tunables
@@ -86,9 +86,10 @@ def check_hpux_tunables(item, params, info, hpux_tunable, thingname):
state = 2
elif float(warn) < pct:
state = 1
- perfdata = [ (thingname, usage, threshold, warn * mimi, crit * mimi) ]
+# name = current , warn , crit , min , max
+ perfdata = [ (thingname, usage, warn * mimi, crit * mimi, 0, threshold) ]
else:
- perfdata = [ (thingname, usage, threshold, '', '') ]
+ perfdata = [ (thingname, usage, None, None, 0, threshold) ]
return (state, nagios_state_names[state] + \
" - %.2f%% used" % pct + state * "!" + " (%d/%d %s)
" % (usage, threshold, thingname), perfdata)
diff --git a/pnp-templates/check_mk-hpux_tunables.maxfiles_lim.php
b/pnp-templates/check_mk-hpux_tunables.maxfiles_lim.php
new file mode 120000
index 0000000..271d5a1
--- /dev/null
+++ b/pnp-templates/check_mk-hpux_tunables.maxfiles_lim.php
@@ -0,0 +1 @@
+check_mk-hpux_tunables.php
\ No newline at end of file
diff --git a/pnp-templates/check_mk-hpux_tunables.nkthread.php
b/pnp-templates/check_mk-hpux_tunables.nkthread.php
new file mode 120000
index 0000000..271d5a1
--- /dev/null
+++ b/pnp-templates/check_mk-hpux_tunables.nkthread.php
@@ -0,0 +1 @@
+check_mk-hpux_tunables.php
\ No newline at end of file
diff --git a/pnp-templates/check_mk-hpux_tunables.nproc.php
b/pnp-templates/check_mk-hpux_tunables.nproc.php
new file mode 120000
index 0000000..271d5a1
--- /dev/null
+++ b/pnp-templates/check_mk-hpux_tunables.nproc.php
@@ -0,0 +1 @@
+check_mk-hpux_tunables.php
\ No newline at end of file
diff --git a/pnp-templates/check_mk-hpux_tunables.php
b/pnp-templates/check_mk-hpux_tunables.php
new file mode 100644
index 0000000..3dd2c66
--- /dev/null
+++ b/pnp-templates/check_mk-hpux_tunables.php
@@ -0,0 +1,50 @@
+<?php
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+$title = str_replace("_", " ", substr($servicedesc, 10));
+$vertical = "Number";
+$format = "%4.0lf";
+$color = "8040f0";
+$line = "202060";
+
+$opt[1] = " --vertical-label \"$vertical\" -X0 -L5 -l 0 -u $MAX[1] --title
\"$title \" ";
+
+$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ".
+ "AREA:$MAX[1]#f3f3f2:\"\" ".
+ "LINE:$MAX[1]#8b8989:\"Kernel threshold\" ".
+ "AREA:var1#$color:\"$title\" ".
+ "LINE1:var1#$line:\"\" ".
+ "GPRINT:var1:LAST:\"Current\: $format\" ".
+ "GPRINT:var1:MAX:\"Peak\: $format \" ".
+ "";
+
+# Add in warning / crit if they're passed to us.
+if (isset($WARN[1]) and $WARN[1] != "") {
+ $def[1] .= "";
+ "HRULE:$WARN[1]#FFFF00:\"Warning at $WARN[1]\" ".
+ "HRULE:$CRIT[1]#FF0000:\"Critical at $CRIT[1]\" ";
+ }
+
+?>
diff --git a/pnp-templates/check_mk-hpux_tunables.semmni.php
b/pnp-templates/check_mk-hpux_tunables.semmni.php
new file mode 120000
index 0000000..271d5a1
--- /dev/null
+++ b/pnp-templates/check_mk-hpux_tunables.semmni.php
@@ -0,0 +1 @@
+check_mk-hpux_tunables.php
\ No newline at end of file
diff --git a/pnp-templates/check_mk-hpux_tunables.semmns.php
b/pnp-templates/check_mk-hpux_tunables.semmns.php
new file mode 120000
index 0000000..271d5a1
--- /dev/null
+++ b/pnp-templates/check_mk-hpux_tunables.semmns.php
@@ -0,0 +1 @@
+check_mk-hpux_tunables.php
\ No newline at end of file
diff --git a/pnp-templates/check_mk-hpux_tunables.shmseg.php
b/pnp-templates/check_mk-hpux_tunables.shmseg.php
new file mode 120000
index 0000000..271d5a1
--- /dev/null
+++ b/pnp-templates/check_mk-hpux_tunables.shmseg.php
@@ -0,0 +1 @@
+check_mk-hpux_tunables.php
\ No newline at end of file
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 94300db..7673ff3 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -465,3 +465,45 @@ def perfometer_mssql_counters_cache_hits(row, check_command,
perf_data):
return "%.1f%%" % perc, h
perfometers["check_mk-mssql_counters.cache_hits"] =
perfometer_mssql_counters_cache_hits
+
+
+
+def perfometer_hpux_tunables(row, check_command, perf_data):
+
+ varname, value, unit, warn, crit, minival, threshold = perf_data[0]
+ value = float(value)
+ threshold = float(threshold)
+
+
+ if warn != "" or crit != "":
+ warn = saveint(warn)
+ crit = saveint(crit)
+
+ # go red if we're over crit
+ if value > crit:
+ color = "#f44"
+ # yellow
+ elif value > warn:
+ color = "#f84"
+ else:
+ # all green lights
+ color = "#2d3"
+ else:
+ # use a brown-ish color if we have no levels.
+ # otherwise it could be "green" all the way to 100%
+ color = "#f4a460"
+
+ used = value / threshold * 100
+
+ return "%.0f%%" % (used), perfometer_linear(used, color)
+
+perfometers["check_mk-hpux_tunables.nproc"] = perfometer_hpux_tunables
+perfometers["check_mk-hpux_tunables.nkthread"] = perfometer_hpux_tunables
+perfometers["check_mk-hpux_tunables.maxfiles_lim"] = perfometer_hpux_tunables
+# this one still doesn't load. I need more test data to find out why.
+perfometers["check_mk-hpux_tunables.semmni"] = perfometer_hpux_tunables
+perfometers["check_mk-hpux_tunables.semmns"] = perfometer_hpux_tunables
+perfometers["check_mk-hpux_tunables.shmseg"] = perfometer_hpux_tunables
+perfometers["check_mk-hpux_tunables.nkthread"] = perfometer_hpux_tunables
+perfometers["check_mk-hpux_tunables.nkthread"] = perfometer_hpux_tunables
+