Module: check_mk
Branch: master
Commit: 829bba9e1654c176bb7870983b64b461ad940605
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=829bba9e1654c1…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Aug 10 16:45:13 2012 +0200
Added check for masterguard ups power state
---
checkman/masterguard_bat_temp | 2 +-
checkman/masterguard_power | 29 ++++++++++++++++++++
checks/masterguard_power | 59 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+), 1 deletions(-)
diff --git a/checkman/masterguard_bat_temp b/checkman/masterguard_bat_temp
index bae9619..85da1b0 100644
--- a/checkman/masterguard_bat_temp
+++ b/checkman/masterguard_bat_temp
@@ -1,4 +1,4 @@
-title: Check temperature sensor on a Mastergurad UPS Device
+title: Check temperature sensor on a Masterguard UPS Device
agents: snmp
author: Bastian Kuhn <bk(a)mathias-kettner.de>
license: GPL
diff --git a/checkman/masterguard_power b/checkman/masterguard_power
new file mode 100644
index 0000000..a082a84
--- /dev/null
+++ b/checkman/masterguard_power
@@ -0,0 +1,29 @@
+title: Check used power of masterguard UPS Device
+agents: snmp
+author: Bastian Kuhn <bk(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the current used power
+ per phase in watt
+ on Emmerson Masterguard UPS devices.
+
+
+item:
+ The used phase
+
+perfdata:
+ The actual power in watt
+
+inventory:
+ One check for each phase is created by the inventory
+
+[parameters]
+parameters (tuple): A pair of numbers for warning and critical level
+
+ warning (int): The max power (watt) that triggers an WARNING state
+
+ critical (int): The power (watt) that triggers an CRITICAL state
+
+[configuration]
+masterguard_power_default_levels (tuple): Default warning and critical level
diff --git a/checks/masterguard_power b/checks/masterguard_power
new file mode 100644
index 0000000..b611694
--- /dev/null
+++ b/checks/masterguard_power
@@ -0,0 +1,59 @@
+#!/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.
+
+masterguard_power_default_levels = (20, 1) # warning / critical
+
+def check_masterguard_power(item, params, info):
+ warn, crit = params
+ for line in info:
+ if line[0] == item:
+ power = saveint(line[1])
+ # Some "RPS SpA" systems are not RFC conform in this value.
+ # The values can get negative but should never be.
+ if power < 0:
+ power *= -1
+ perfdata = [ ( "power", power, warn, crit, 0 ) ]
+ infotext = " - current power: %dW (warn/crit at %dW/%dW)" % \
+ (power, warn, crit)
+
+ if power <= crit:
+ return (2, "CRIT" + infotext, perfdata)
+ elif power <= warn:
+ return (1, "WARN" + infotext, perfdata)
+ else:
+ return (0, "OK" + infotext, perfdata)
+
+ return (3, "UNKNOWN - Phase %s not found in SNMP output" % item)
+
+check_info['masterguard_power'] = {
+ "inventory_function" : lambda info: [ ( x[0],
"masterguard_power_default_levels") for x in info ],
+ "check_function" : check_masterguard_power,
+ "service_description" : "Power phase %s",
+ "has_perfdata" : True,
+ "group" : "hw_temperature",
+ "snmp_info" : ( ".1.3.6.1.2.1.33.1.4.4.1", [ 0, 4 ] ),
+ "snmp_scan_function" : lambda oid: "masterguard" in
oid('.1.3.6.1.2.1.1.1.0').lower(),
+}