Module: check_mk
Branch: master
Commit: ab07d442026c05a84f65c19c2d807f9a50f7e209
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ab07d442026c05…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Thu Jul 3 17:42:46 2014 +0200
raritan_pdu_outletcount: got levels now to check the value against and a WATO rule to set
them
---
checkman/raritan_pdu_outletcount | 15 ++++++++++++---
checks/raritan_pdu_outletcount | 18 +++++++++++++++---
web/plugins/wato/check_parameters.py | 18 ++++++++++++++++++
3 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/checkman/raritan_pdu_outletcount b/checkman/raritan_pdu_outletcount
index 6725d86..f5c6a97 100644
--- a/checkman/raritan_pdu_outletcount
+++ b/checkman/raritan_pdu_outletcount
@@ -4,14 +4,23 @@ catalog: hw/other
license: GPL
distribution: check_mk
description:
- This check displays the current outlet count of the Raritan PX-2000
+ Checks 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}.
+ By default this check does report only and returns always {OK}.
+ Only if you set levels explicitly, it returns {WARN} or {CRIT} if
+ the value is outside the given ranges.
perfdata:
- Exactly one number: The outlet count.
+ Exactly one number: The outlet count. If levels are given: Together
+ with it's levels.
inventory:
Creates exactly one check per host called Outlet Count.
+[parameters]
+tuple(int, int, int, int): crit_low, warn_low, warn_high, crit_high:
+ If the value is lower or equal crit_low, the check returns {CRIT}.
+ If the value is lower or equal warn_low, the check returns {WARN}.
+ If the value is higher or equal warn_high, the check returns {WARN}.
+ If the value is higher or equal crit_high, the check returns {CRIT}.
diff --git a/checks/raritan_pdu_outletcount b/checks/raritan_pdu_outletcount
index f55fa3a..0f3fb72 100644
--- a/checks/raritan_pdu_outletcount
+++ b/checks/raritan_pdu_outletcount
@@ -31,14 +31,26 @@ def inventory_raritan_pdu_outletcount(info):
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
+ outletcount = int(info[0][0])
+ status = 0
+ if params:
+ crit_low, warn_low, warn_high, crit_high = params
+ perfdata = [ ("outletcount", outletcount, "%d:%d" %
(warn_low, warn_high), "%d:%d" % (crit_low, crit_high), 0) ]
+ if outletcount <= warn_low or outletcount >= warn_high:
+ status = 1
+ if outletcount <= crit_low or outletcount >= crit_high:
+ status = 2
+ else:
+ perfdata = [ ("outletcount", outletcount, None, None, 0) ]
+
+ message = "Outlet Count is %s" % outletcount
+ return status, message, perfdata
check_info['raritan_pdu_outletcount'] = {
"inventory_function" : inventory_raritan_pdu_outletcount,
"check_function" : check_raritan_pdu_outletcount,
"service_description" : "Outlet Count",
+ "group" : "plug_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: \
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 9a3a1f0..4785542 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -5365,3 +5365,21 @@ register_check_parameters(
),
"first"
)
+
+register_check_parameters(
+ subgroup_environment,
+ "plug_count",
+ _("Number of active Plugs"),
+ Tuple(
+ help = _("Levels for the number of active plugs in a devices."),
+ elements = [
+ Integer(title = _("critical if below or equal"), default_value =
30),
+ Integer(title = _("warning if below or equal"), default_value =
32),
+ Integer(title = _("warning if above or equal"), default_value =
38),
+ Integer(title = _("critical if above or equal"), default_value =
40),
+ ]),
+ None,
+ "first"
+)
+
+