Module: check_mk
Branch: master
Commit: c3e0aa2d34c0c1dfb700b420d5965884b5d3f6d0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c3e0aa2d34c0c1…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Thu Jun 26 18:47:03 2014 +0200
raritan_pdu_outletcount: new check for outlet count of Raritan PX-2000 family PDUs
---
.werks/995 | 8 ++
ChangeLog | 1 +
checkman/raritan_pdu_outletcount | 17 ++++
checks/raritan_pdu_outletcount | 46 ++++++++++
pnp-templates/check_mk-raritan_pdu_outletcount.php | 90 ++++++++++++++++++++
web/plugins/perfometer/check_mk.py | 5 ++
6 files changed, 167 insertions(+)
diff --git a/.werks/995 b/.werks/995
new file mode 100644
index 0000000..f3fe415
--- /dev/null
+++ b/.werks/995
@@ -0,0 +1,8 @@
+Title: raritan_pdu_outletcount: new check for outlet count of Raritan PX-2000 family
PDUs
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1403801183
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 90cd230..89f4c9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
NOTE: Please refer to the migration notes!
Checks & Agents:
+ * 0995 raritan_pdu_outletcount: new check for outlet count of Raritan PX-2000 family
PDUs
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output
of if checks...
diff --git a/checkman/raritan_pdu_outletcount b/checkman/raritan_pdu_outletcount
new file mode 100644
index 0000000..6725d86
--- /dev/null
+++ b/checkman/raritan_pdu_outletcount
@@ -0,0 +1,17 @@
+title: Raritan PX-2000 family PDU outlet count
+agents: snmp
+catalog: hw/other
+license: GPL
+distribution: check_mk
+description:
+ This check displays the current outlet count of the Raritan PX-2000
+ family of intelligent rack power distribution units (iPDUs).
+
+ It is for reporting only and returns always {OK}.
+
+perfdata:
+ Exactly one number: The outlet count.
+
+inventory:
+ Creates exactly one check per host called Outlet Count.
+
diff --git a/checks/raritan_pdu_outletcount b/checks/raritan_pdu_outletcount
new file mode 100644
index 0000000..f55fa3a
--- /dev/null
+++ b/checks/raritan_pdu_outletcount
@@ -0,0 +1,46 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | 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.
+
+def inventory_raritan_pdu_outletcount(info):
+ if len(info) > 0 and len(info[0]) > 0:
+ return [ (None, None) ]
+ else:
+ return []
+
+def check_raritan_pdu_outletcount(item, params, info):
+ message = "Outlet Count is %s" % info[0][0]
+ perfdata = [ ("outletcount", int(info[0][0])) ]
+ return 0, message, perfdata
+
+check_info['raritan_pdu_outletcount'] = {
+ "inventory_function" : inventory_raritan_pdu_outletcount,
+ "check_function" : check_raritan_pdu_outletcount,
+ "service_description" : "Outlet Count",
+ "has_perfdata" : True,
+ "snmp_info" : (".1.3.6.1.4.1.13742.6.3.2.2.1.4",
["1"]), # outletCount
+ "snmp_scan_function" : lambda oid: \
+
oid(".1.3.6.1.4.1.13742.6.3.2.1.1.3.1").startswith("PX2-2")
+}
diff --git a/pnp-templates/check_mk-raritan_pdu_outletcount.php
b/pnp-templates/check_mk-raritan_pdu_outletcount.php
new file mode 100644
index 0000000..de644a1
--- /dev/null
+++ b/pnp-templates/check_mk-raritan_pdu_outletcount.php
@@ -0,0 +1,90 @@
+<?php
+#
+# Copyright (c) 2006-2010 Joerg Linge (
http://www.pnp4nagios.org)
+# Default Template used if no other template is found.
+# Don`t delete this file !
+#
+# Define some colors ..
+#
+$_WARNRULE = '#FFFF00';
+$_CRITRULE = '#FF0000';
+$_AREA = '#256aef';
+$_LINE = '#000000';
+#
+# Initial Logic ...
+#
+
+foreach ($this->DS as $KEY=>$VAL) {
+
+ $maximum = "";
+ $minimum = "";
+ $critical = "";
+ $crit_min = "";
+ $crit_max = "";
+ $warning = "";
+ $warn_max = "";
+ $warn_min = "";
+ $vlabel = " ";
+ $lower = "";
+ $upper = "";
+
+ if ($VAL['WARN'] != "" && is_numeric($VAL['WARN']) ){
+ $warning = $VAL['WARN'];
+ }
+ if ($VAL['WARN_MAX'] != "" &&
is_numeric($VAL['WARN_MAX']) ) {
+ $warn_max = $VAL['WARN_MAX'];
+ }
+ if ( $VAL['WARN_MIN'] != "" &&
is_numeric($VAL['WARN_MIN']) ) {
+ $warn_min = $VAL['WARN_MIN'];
+ }
+ if ( $VAL['CRIT'] != "" && is_numeric($VAL['CRIT']) )
{
+ $critical = $VAL['CRIT'];
+ }
+ if ( $VAL['CRIT_MAX'] != "" &&
is_numeric($VAL['CRIT_MAX']) ) {
+ $crit_max = $VAL['CRIT_MAX'];
+ }
+ if ( $VAL['CRIT_MIN'] != "" &&
is_numeric($VAL['CRIT_MIN']) ) {
+ $crit_min = $VAL['CRIT_MIN'];
+ }
+ if ( $VAL['MIN'] != "" && is_numeric($VAL['MIN']) ) {
+ $lower = " --lower=" . $VAL['MIN'];
+ $minimum = $VAL['MIN'];
+ }
+ if ( $VAL['MAX'] != "" && is_numeric($VAL['MAX']) ) {
+ $maximum = $VAL['MAX'];
+ }
+ if ($VAL['UNIT'] == "%%") {
+ $vlabel = "%";
+ $upper = " --upper=101 ";
+ $lower = " --lower=0 ";
+ }
+ else {
+ $vlabel = $VAL['UNIT'];
+ }
+
+ $opt[$KEY] = '--vertical-label "' . $vlabel . '" --title
"' . $this->MACRO['DISP_HOSTNAME'] . ' / ' .
$this->MACRO['DISP_SERVICEDESC'] . '"' . $upper . $lower;
+ $ds_name[$KEY] = $VAL['LABEL'];
+ $def[$KEY] = rrd::def ("var1", $VAL['RRDFILE'],
$VAL['DS'], "AVERAGE");
+ $def[$KEY] .= rrd::gradient("var1", "3152A5", "BDC6DE",
rrd::cut($VAL['NAME'],16), 20);
+ $def[$KEY] .= rrd::line1 ("var1", $_LINE );
+ $def[$KEY] .= rrd::gprint ("var1",
array("LAST","MAX","AVERAGE"), "%3.0lf
%S".$VAL['UNIT']);
+ if ($warning != "") {
+ $def[$KEY] .= rrd::hrule($warning, $_WARNRULE, "Warning $warning \\n");
+ }
+ if ($warn_min != "") {
+ $def[$KEY] .= rrd::hrule($warn_min, $_WARNRULE, "Warning (min) $warn_min
\\n");
+ }
+ if ($warn_max != "") {
+ $def[$KEY] .= rrd::hrule($warn_max, $_WARNRULE, "Warning (max) $warn_max
\\n");
+ }
+ if ($critical != "") {
+ $def[$KEY] .= rrd::hrule($critical, $_CRITRULE, "Critical $critical \\n");
+ }
+ if ($crit_min != "") {
+ $def[$KEY] .= rrd::hrule($crit_min, $_CRITRULE, "Critical (min) $crit_min
\\n");
+ }
+ if ($crit_max != "") {
+ $def[$KEY] .= rrd::hrule($crit_max, $_CRITRULE, "Critical (max) $crit_max
\\n");
+ }
+}
+?>
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 76681b6..eef0eb6 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -1065,3 +1065,8 @@ def perfometer_raritan_pdu_inlet(row, check_command, perf_data):
perfometers["check_mk-raritan_pdu_inlet"] = perfometer_raritan_pdu_inlet
+def perfometer_raritan_pdu_outletcount(row, check_command, perf_data):
+ outletcount = float(perf_data[0][1])
+ return "%d" % outletcount, perfometer_logarithmic(outletcount, 20, 2,
"#da6")
+
+perfometers["check_mk-raritan_pdu_outletcount"] =
perfometer_raritan_pdu_outletcount