Module: check_mk
Branch: master
Commit: 8e7b9090c2bd23eaa15ff9b849b2cbdf1039d803
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8e7b9090c2bd23…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Aug 10 14:00:30 2012 +0200
Added new check for masterguard battery capacity
---
checkman/masterguard_capacity | 27 +++++++++++++++++++++
checks/masterguard_capacity | 52 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 79 insertions(+), 0 deletions(-)
diff --git a/checkman/masterguard_capacity b/checkman/masterguard_capacity
new file mode 100644
index 0000000..747282b
--- /dev/null
+++ b/checkman/masterguard_capacity
@@ -0,0 +1,27 @@
+title: Check the remaining battery capacity of a Mastergurad UPS Device
+agents: snmp
+author: Bastian Kuhn <bk(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the remaining battery capacity in
+ minutes for an Masterguard UPS Device
+
+item:
+ none
+
+perfdata:
+ The remaining time in minutes
+
+inventory:
+ One service will be created
+
+[parameters]
+parameters (tuple): A pair of numbers for warning and critical level
+
+ warning (int): The amount of minutes left which triggers an WARNING state
+
+ critical (int): The amount of minutes left wich triggers an WARNING state
+
+[configuration]
+masterguard_capacity_default_levels (tuple): Default warning and critical level
diff --git a/checks/masterguard_capacity b/checks/masterguard_capacity
new file mode 100644
index 0000000..9727c80
--- /dev/null
+++ b/checks/masterguard_capacity
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 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.
+
+
+# ==> Remaining capacity in estimated minutes
+# SNMPv2-SMI::mib-2.33.1.2.3.0 = INTEGER: 150
+
+masterguard_capacity_default_levels = (20, 10)
+
+def check_masterguard_capacity(item, params, info):
+ warn, crit = params
+ minutes = int(info[0][0])
+ message = " - remaining capacity is estimated %d minutes" % minutes
+ state = 0
+ if minutes <= warn:
+ state = 1
+ if minutes <= crit:
+ state = 2
+ perf = [("capacity", minutes, warn, crit)]
+ return (state, nagios_state_names[state] + message, perf )
+
+check_info['masterguard_capacity'] = {
+ "inventory_function" : lambda info: [( None,
"masterguard_capacity_default_levels")],
+ "check_function" : check_masterguard_capacity,
+ "service_description" : "Battery capacity",
+ "has_perfdata" : True,
+ "snmp_info" : ( ".1.3.6.1.2.1.33.1.2", [ "3.0"
] ),
+ "snmp_scan_function" : lambda oid: "masterguard" in
oid('.1.3.6.1.2.1.1.1.0').lower(),
+}