Module: check_mk
Branch: master
Commit: 3bf97166bd44ccea17eea7f653726b48f000cb43
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3bf97166bd44cc…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Jul 24 11:36:20 2014 +0200
sentry_pdu: New check to monitor plugs of sentry PDUs
---
.werks/183 | 8 ++++
ChangeLog | 3 +-
checkman/sentry_pdu | 18 +++++++++
checks/sentry_pdu | 73 ++++++++++++++++++++++++++++++++++
web/plugins/perfometer/check_mk.py | 13 +++---
web/plugins/wato/check_parameters.py | 3 +-
6 files changed, 111 insertions(+), 7 deletions(-)
diff --git a/.werks/183 b/.werks/183
new file mode 100644
index 0000000..5e76128
--- /dev/null
+++ b/.werks/183
@@ -0,0 +1,8 @@
+Title: sentry_pdu: New check to monitor plugs of sentry PDUs
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1406194542
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 4f05f54..34be56d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -38,8 +38,9 @@
* 1133 qlogic_sanbox_fabric_element: New Check for Fabric Elements in QLogic SANbox
Fibre Channel Switches
* 1134 bintec_sensors.fan: New Check for Fan Speed of Bintec Routers
* 1135 bintec_sensors.voltage, bintec_sensors.temp: New Checks for Voltage and
Temperature Sensors of Bintec Routers
- * 1136 bintec_brrp_status: New Check for BRRP States on Bintec Routers
* 1048 mem.win: support predictive levels...
+ * 1136 bintec_brrp_status: New Check for BRRP States on Bintec Routers
+ * 0183 sentry_pdu: New check to monitor plugs of sentry 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/sentry_pdu b/checkman/sentry_pdu
new file mode 100644
index 0000000..018b902
--- /dev/null
+++ b/checkman/sentry_pdu
@@ -0,0 +1,18 @@
+title: Sentry PDU Devices
+agents: snmp
+catalog: hw/other
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the state of the plugs of Sentry PDUs.
+ As default the state of the time from inventory will result in the state {OK},
+ other states are in the state {CRIT}.
+ The required state can be configured to {on} or {off}. Then these plugs are in
+ the state {OK} when they are in the configured state, and {CRIT} otherwise.
+
+item:
+ The ID Number of the plug as given by the device
+
+inventory:
+ One service per plug will be created
+
diff --git a/checks/sentry_pdu b/checks/sentry_pdu
new file mode 100644
index 0000000..63d279c
--- /dev/null
+++ b/checks/sentry_pdu
@@ -0,0 +1,73 @@
+#!/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_sentry_pdu(info):
+ for line in info:
+ yield line[0], int(line[1])
+
+def check_sentry_pdu(item, params, info):
+ states = {
+ 0: "off",
+ 1: "on",
+ 2: "offWait",
+ 3: "onWait",
+ 4: "offError",
+ 5: "onError",
+ 6: "noComm",
+ }
+ for name, state, power in info:
+ if item == name:
+ required_state = params
+ # The Wato rule returns eighter on or off
+ if required_state == 'on':
+ required_state = 1
+ elif required_state == 'off':
+ required_state = 0
+ state = int(state)
+ power = int(power)
+ infotext = "State is %s" % states[state]
+ if state != required_state:
+ yield 2, infotext
+ else:
+ yield 0, infotext
+
+ infotext = "Current consumption %s Watt" % power
+ perfdata = [ ('power', power )]
+ yield 0, infotext, perfdata
+ return
+
+ yield 3, 'Phase information not found'
+ return
+
+check_info["sentry_pdu"] = {
+ "check_function" : check_sentry_pdu,
+ "inventory_function" : inventory_sentry_pdu,
+ "service_description" : "Plug %s",
+ "group" : "plugs",
+ "snmp_info" : ( ".1.3.6.1.4.1.1718.3.2.2.1", [ 3, 5,
12 ] ),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0")
== ".1.3.6.1.4.1.1718.3",
+}
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 74e6ac6..69a44c9 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -381,6 +381,14 @@ perfometers["check_mk-dell_chassis_power"] =
perfometer_power
perfometers["check_mk-dell_chassis_powersupplies"] = perfometer_power
perfometers["check_mk-hp-proliant_power"] = perfometer_power
+def perfometer_power_simple(row, check_command, perf_data):
+ watt = int(perf_data[0][1])
+ text = "%s Watt" % watt
+ return text, perfometer_logarithmic(watt, 150, 2, "#60f020")
+
+perfometers["check_mk-ibm_svc_enclosurestats.power"] = perfometer_power_simple
+perfometers["check_mk-sentry_pdu"] = perfometer_power_simple
+
def perfometer_users(row, check_command, perf_data):
state = row["service_state"]
color = "#39f"
@@ -1008,11 +1016,6 @@ def perfometer_check_mk_ibm_svc_cache(row, check_command,
perf_data):
perfometers["check_mk-ibm_svc_nodestats.cache"] =
perfometer_check_mk_ibm_svc_cache
perfometers["check_mk-ibm_svc_systemstats.cache"] =
perfometer_check_mk_ibm_svc_cache
-def perfometer_check_mk_ibm_svc_power(row, check_command, perf_data):
- watt = int(perf_data[0][1])
- text = "%s Watt" % watt
- return text, perfometer_logarithmic(watt, 150, 2, "#60f020")
-perfometers["check_mk-ibm_svc_enclosurestats.power"] =
perfometer_check_mk_ibm_svc_power
def perfometer_licenses_percent(row, check_command, perf_data):
licenses = float(perf_data[0][1])
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 33b2a89..73a2ff4 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3982,7 +3982,8 @@ register_check_parameters(
default_value = "on"
),
TextAscii(
- title = _("Plug Item ID number"),
+ title = _("Plug Item number or name"),
+ help = _("If you need the number or the name depends on the check. Just take
a look to the service description. "),
allow_empty = True),
None
)