Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / ups_eaton_enviroment
blobe3407bb21e4884c6a710f737e36b9831b10baa79
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
27 factory_settings["ups_eaton_enviroment_default"] = {
28 "temp": (40, 50),
29 "remote_temp": (40, 50),
30 "humidity": (65, 80),
34 def inventory_ups_eaton_enviroment(info):
35 if len(info) > 0:
36 return [(None, {})]
39 def check_ups_eaton_enviroment(item, params, info):
40 wert = map(saveint, info[0])
41 i = 0
42 state = 0
43 messages = []
44 perfdata = []
45 for sensor, sensor_name, unit in [("temp", "Temperature", u"°C"),
46 ("remote_temp", "Remote-Temperature", u"°C"),
47 ("humidity", "Humidity", "%")]:
49 warn, crit = params.get(sensor)
50 perfdata.append((sensor, wert[i], warn, crit))
51 text = "%s: %d%s (warn/crit at %d%s/%d%s)" % \
52 (sensor_name, wert[i],unit, warn, unit, crit, unit)
54 if wert[i] >= crit:
55 state = 2
56 text += "(!!)"
57 elif wert[i] >= warn:
58 state = max(state, 1)
59 text += "(!)"
61 i += 1
62 messages.append(text)
64 return (state, ", ".join(messages), perfdata)
67 check_info['ups_eaton_enviroment'] = {
68 "default_levels_variable" : "ups_eaton_enviroment_default",
69 "inventory_function" : inventory_ups_eaton_enviroment,
70 "check_function" : check_ups_eaton_enviroment,
71 "service_description" : "Enviroment",
72 "has_perfdata" : True,
73 "group" : "eaton_enviroment",
74 "snmp_info" : ( ".1.3.6.1.4.1.534.1.6", [1,5,6 ] ),
75 "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.2.0") in \
76 [".1.3.6.1.4.1.705.1.2",
77 ".1.3.6.1.4.1.534.1",
78 ".1.3.6.1.4.1.705.1"],