GUI CSS: Deployed view styles for layouts (CMK-1171)
[check_mk.git] / checks / dell_om_fans
blobf0b36ee1939500a0748054ea5d91f5550a9d656f
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.
28 def inventory_dell_om_fans(info):
29 for line in info:
30 yield (line[0], {})
33 def _construct_levels(warn_upper, crit_upper, warn_lower, crit_lower):
34 # We've seen several possibilities:
35 # - 1, 2, 3, 4
36 # - "", "", 3, 4
37 # - "", "", "", 4
38 if warn_lower not in ["", None] and crit_lower not in ["", None]:
39 lower = (int(warn_lower), int(crit_lower))
40 elif crit_lower not in ["", None]:
41 lower = (int(crit_lower), int(crit_lower))
42 else:
43 lower = (None, None)
45 if warn_upper not in ["", None] and crit_upper not in ["", None]:
46 upper = (int(warn_upper), int(crit_upper))
47 elif crit_upper not in ["", None]:
48 upper = (int(crit_upper), int(crit_upper))
49 else:
50 upper = (None, None)
52 return lower, upper
55 def check_dell_om_fans(item, params, info):
56 translate_status = {
57 "1": (3, "OTHER"),
58 "2": (3, "UNKNOWN"),
59 "3": (0, "OK"),
60 "4": (1, "NON CRITICAL UPPER"),
61 "5": (2, "CRITICAL UPPER"),
62 "6": (2, "NON RECOVERABLE UPPER"),
63 "7": (1, "NON CRITICAL LOWER"),
64 "8": (2, "CRITICAL LOWER"),
65 "9": (2, "NON RECOVERABLE LOWER"),
66 "10": (2, "FAILED"),
69 for index, status, value, name, warn_upper, crit_upper, \
70 warn_lower, crit_lower in info:
71 if index == item:
72 state, state_readable = translate_status[status]
73 yield state, "Status: %s, Name: %s" % \
74 (state_readable, name)
75 if not params:
76 lower, upper = _construct_levels(warn_upper, crit_upper, warn_lower, crit_lower)
77 params['lower'] = lower
78 params['upper'] = upper
79 yield check_fan(int(value), params)
82 check_info["dell_om_fans"] = {
83 "check_function": check_dell_om_fans,
84 "inventory_function": inventory_dell_om_fans,
85 "service_description": "Fan %s",
86 "snmp_scan_function": scan_dell_om,
87 "snmp_info": (
88 ".1.3.6.1.4.1.674.10892.1.700.12.1",
90 "2", # MIB-Dell-10892::coolingDeviceIndex
91 "5", # MIB-Dell-10892::coolingDeviceStatus
92 "6", # MIB-Dell-10892::coolingDeviceReading
93 "8", # MIB-Dell-10892::coolingDeviceLocationName
94 "10", # MIB-Dell-10892::coolingDeviceUpperNonCriticalThreshold
95 "11", # MIB-Dell-10892::coolingDeviceUpperCriticalThreshold
96 "12", # MIB-Dell-10892::coolingDeviceLowerNonCriticalThreshold
97 "13", # MIB-Dell-10892::coolingDeviceLowerCriticalThreshold
98 ]),
99 "includes": ["fan.include", "dell_om.include"],
100 "has_perfdata": True,
101 "group": "hw_fans",