Module: check_mk
Branch: master
Commit: 08da92c2fde2a00ba318ae03b2c10820bf1226d3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=08da92c2fde2a0…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Thu Aug 22 11:24:46 2013 +0200
extra check for batteries of liebert devices
---
checks/liebert_bat_temp | 62 +++++++++++++++++++++++++++++++++++++++++++++++
checks/ups_bat_temp | 9 +++----
2 files changed, 66 insertions(+), 5 deletions(-)
diff --git a/checks/liebert_bat_temp b/checks/liebert_bat_temp
new file mode 100644
index 0000000..06389e6
--- /dev/null
+++ b/checks/liebert_bat_temp
@@ -0,0 +1,62 @@
+#!/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.
+
+
+liebert_bat_temp_default = (40, 50) # warning / critical
+
+def inventory_liebert_bat_temp(info):
+ if info:
+ return [ ( None, "liebert_bat_temp_default") ]
+
+def check_liebert_bat_temp(item, params, info):
+ warn, crit = params
+ if not info:
+ return 3, "Data Missing in SNMP Output"
+ line = info[0]
+ temp = saveint(line[0])
+ perfdata = [ ( "temp", temp, warn, crit, 80 ) ]
+ infotext = "temperature: %d°C , (warn/crit at %d°C/%d°C) " % \
+ (temp, warn, crit)
+
+ if temp >= crit:
+ return (2, infotext, perfdata)
+ elif temp >= warn:
+ return (1, infotext, perfdata)
+ else:
+ return (0, infotext, perfdata)
+
+
+check_info['liebert_bat_temp'] = {
+ "inventory_function" : inventory_liebert_bat_temp,
+ "check_function" : check_liebert_bat_temp,
+ "service_description" : "Battery Temp",
+ "has_perfdata" : True,
+ "group" : "hw_temperature",
+ "snmp_info" : (".1.3.6.1.4.1.476.1.42.3.4.1.3.3.1.3",
"1"),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0") in \
+ [".1.3.6.1.4.1.476.1.42"]
+
+}
diff --git a/checks/ups_bat_temp b/checks/ups_bat_temp
index b3be01e..022536c 100644
--- a/checks/ups_bat_temp
+++ b/checks/ups_bat_temp
@@ -35,9 +35,9 @@ def check_ups_bat_temp(item, params, info):
warn, crit = params
for line in info:
if line[0] == item:
- power = int(line[1])
+ power = saveint(line[1])
perfdata = [ ( "temp", power, warn, crit, 80 ) ]
- infotext = "current: %d°C , (warn/crit at %d°C/%d°C) " % \
+ infotext = "temperature: %d°C , (warn/crit at %d°C/%d°C) " % \
(power, warn, crit)
if power >= crit:
@@ -47,7 +47,7 @@ def check_ups_bat_temp(item, params, info):
else:
return (0, infotext, perfdata)
- return (3, "Temperatur %s not found in SNMP output" % item)
+ return (3, "Temperature %s not found in SNMP output" % item)
check_info['ups_bat_temp'] = {
"inventory_function" : inventory_ups_bat_temp,
@@ -57,8 +57,7 @@ check_info['ups_bat_temp'] = {
"group" : "hw_temperature",
"snmp_info" : ( ".1.3.6.1.2.1.33.1", ["1.5",
"2.7" ] ),
"snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0") in \
- [ ".1.3.6.1.4.1.818.1.100.1.1",
".1.3.6.1.2.1.33", ".1.3.6.1.2.1.33.2",
- ".1.3.6.1.4.1.476.1.42" ] \
+
[".1.3.6.1.4.1.818.1.100.1.1",".1.3.6.1.2.1.33",".1.3.6.1.2.1.33.2"]
\
or
oid('.1.3.6.1.2.1.33.1.1.1.0').startswith('RPS'),
}