GUI CSS: Removed snapin styles from py modules and added a _snapins.scss for the...
[check_mk.git] / checks / dell_om_sensors
blob830f9f6aabdb7c0268ffd84de51dae8523b1dfa3
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["dell_om_sensors_default_levels"] = {"levels": (50, 60)}
30 def dell_om_sensors_item(name):
31 return name.replace("Temp", "").strip()
34 def inventory_dell_om_sensors(info):
35 for line in info:
36 if line[3]:
37 yield dell_om_sensors_item(line[3]), {}
40 def check_dell_om_sensors(item, params, info):
41 sensor_states = {
42 1: "other",
43 2: "unknown",
44 10: "failed",
46 for idx, sensor_state, reading, location_name, dev_crit, dev_warn, dev_warn_lower, dev_crit_lower in info:
47 if item == idx or dell_om_sensors_item(location_name) == item:
48 sensor_state = int(sensor_state)
49 if sensor_state in [1, 2, 10]:
50 return 2, "Sensor is: " + sensor_states[sensor_state]
52 temp = int(reading) / 10.0
54 dev_warn, dev_crit, dev_warn_lower, dev_crit_lower = \
55 [float(v)/10 if v else None for v in [ dev_warn, dev_crit, dev_warn_lower, dev_crit_lower ]]
57 return check_temperature(
58 temp,
59 params,
60 "dell_om_sensors_%s" % item,
61 dev_levels=(dev_warn, dev_crit),
62 dev_levels_lower=(dev_warn_lower, dev_crit_lower))
65 check_info["dell_om_sensors"] = {
66 "check_function": check_dell_om_sensors,
67 "inventory_function": inventory_dell_om_sensors,
68 "service_description": "Temperature %s",
69 "has_perfdata": True,
70 "group": "temperature",
71 # There is no other way to find out that openmanage is present.
72 "snmp_scan_function": scan_dell_om,
73 "snmp_info": (
74 ".1.3.6.1.4.1.674.10892.1.700.20.1",
76 '2', # ProbeIndex
77 '5', # ProbeStatus
78 '6', # ProbeReading
79 #'7', # ProbeType
80 '8', # ProbeLocationName
81 '10', # ProbeUpperCriticalThreshold',
82 '11', # ProbeUpperNonCriticalThreshold',
83 '12', # ProbeLowerNonCriticalThreshold',
84 '13', # ProbeLowerCriticalThreshold',
85 #'16.1', # ProbeDiscreteReading',
86 ]),
87 "includes": ["dell_om.include", "temperature.include"],
88 "default_levels_variable": "dell_om_sensors_default_levels"