Module: check_mk
Branch: master
Commit: 411e8ed4f6d0fb24160e928ff95a6f301df0f275
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=411e8ed4f6d0fb…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Oct 23 15:34:48 2012 +0200
Added new Check for Eaton UPS Devices
---
ChangeLog | 1 +
checkman/ups_eaton_enviroment | 29 +++++++++++++++
checks/ups_eaton_enviroment | 67 ++++++++++++++++++++++++++++++++++
web/plugins/perfometer/check_mk.py | 12 ++++++
web/plugins/wato/check_parameters.py | 37 +++++++++++++------
5 files changed, 135 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2499f45..7b48fc9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -73,6 +73,7 @@
counters if a base value is set
* win_dhcp_pools: do not inventorize empty pools any more. You can switch
back to old behaviour with win_dhcp_pools_inventorize_empty = True
+ * Added new Check for Eaton UPS Devices
1.2.0p3:
Mulitisite
diff --git a/checkman/ups_eaton_enviroment b/checkman/ups_eaton_enviroment
new file mode 100644
index 0000000..704f983
--- /dev/null
+++ b/checkman/ups_eaton_enviroment
@@ -0,0 +1,29 @@
+title: Tempreature and Humidity Sensors for Eaton UPS devices
+agents: snmp
+author: Bastian Kuhn <bk(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ Shows Sensor information for Tempreature, External Tempreature an Humidity for
+ Eaton UPS desvices
+
+item:
+ None
+
+perfdata:
+ Tempreature
+ External Tempreature
+ Humidty
+
+inventory:
+ One service will be created
+
+[parameters]
+parameters (dict): One Tuple for each sensor
+
+ warning (int): The lower limit which triggers an WARNING state
+
+ critical (int): The lower limit which triggers an CRITICAL state
+
+[configuration]
+ups_eaton_enviroment_default (dict): Default warning and critical level for each sensor
diff --git a/checks/ups_eaton_enviroment b/checks/ups_eaton_enviroment
new file mode 100644
index 0000000..f07e329
--- /dev/null
+++ b/checks/ups_eaton_enviroment
@@ -0,0 +1,67 @@
+#!/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.
+
+
+ups_eaton_enviroment_default = {
+ "temp" : (40, 50),
+ "remote_temp" : (40, 50),
+ "humidity" : (65, 80),
+}
+def inventory_ups_eaton_enviroment(info):
+ if len(info) > 0:
+ return [ (None, "ups_eaton_enviroment_default") ]
+
+def check_ups_eaton_enviroment(item, params, info):
+ wert = map(saveint, info[0])
+ i = 0
+ state = 0
+ messages = []
+ perfdata = []
+ for sensor, sensor_name, unit in [("temp", "Temperature",
"°C"), ("remote_temp", "Remote-Temperature",
"°C"), ("humidity", "Humidity", "%")]:
+ warn, crit = params.get(sensor)
+ perfdata.append((sensor, wert[i], warn, crit))
+ text = "%s: %d%s (warn/crit at %d%s/%d%s)" % \
+ (sensor_name, wert[i],unit, warn, unit, crit, unit)
+ if wert[i] >= crit:
+ state = 2
+ text += "(!!)"
+ elif wert[i] >= warn:
+ state = max(state, 1)
+ text += "(!)"
+ i += 1
+ messages.append(text)
+ return (state, nagios_state_names[state] + " - " + ",
".join(messages), perfdata)
+
+check_info['ups_eaton_enviroment'] = {
+ "inventory_function" : inventory_ups_eaton_enviroment,
+ "check_function" : check_ups_eaton_enviroment,
+ "service_description" : "Enviroment",
+ "has_perfdata" : True,
+ "group" : "eaton_enviroment",
+ "snmp_info" : ( ".1.3.6.1.4.1.534.1.6", [1,5,6 ] ),
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0") in
[".1.3.6.1.4.1.534.1"]
+
+}
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 32992ce..199774a 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -590,3 +590,15 @@ def perfometer_carel_uniflair_cooling(row, check_command,
perf_data):
perfometers['check_mk-carel_uniflair_cooling'] =
perfometer_carel_uniflair_cooling
+def perfometer_eaton(row, command, perf):
+ h = "<table><tr>"
+ vname, wert, einheit, warn, crit, minw, maxw = perf[0]
+
+ h += perfometer_td(int(wert), "silver")
+ diff = 100 - int(wert)
+ h += perfometer_td(diff, "white")
+ h += "</tr></table>"
+ return u"%s°C" % wert, h
+
+perfometers['check_mk-ups_eaton_enviroment'] = perfometer_eaton
+
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 28716e2..1255630 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1828,18 +1828,33 @@ checkgroups.append((
checkgroups.append((
subgroup_environment,
- "hw_temperature",
- _("Hardware temperature (CPU, Memory, etc.)"),
- Tuple(
- help = _("Temperature levels for internal sensors found in many appliances,
"
- "switches, routers, mainboards and other devices. "),
+ "eaton_enviroment",
+ _("Temperature and Humidity for Eaton UPS"),
+ Dictionary(
elements = [
- Integer(title = "warning at", unit = u"°C"),
- Integer(title = "critical at", unit = u"°C"),
- ]),
- TextAscii(
- title = _("Sensor ID"),
- help = _("The identificator of the themal sensor.")),
+ ( "temp",
+ Tuple(
+ title = _("Temerature"),
+ elements = [
+ Integer(title = "warning at", unit = u"°C",
default_value = 26),
+ Integer(title = "critical at", unit = u"°C",
default_value = 30),
+ ])),
+ ( "remote_temp",
+ Tuple(
+ title = _("Remote Temerature"),
+ elements = [
+ Integer(title = "warning at", unit = u"°C",
default_value = 26),
+ Integer(title = "critical at", unit = u"°C",
default_value = 30),
+ ])),
+ ( "humidity",
+ Tuple(
+ title = _("Humidity"),
+ elements = [
+ Integer(title = "warning at", unit = u"%",
default_value = 60),
+ Integer(title = "critical at", unit = u"%",
default_value = 75),
+ ])),
+ ]),
+ None,
"first"))
checkgroups.append((