Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / dell_idrac_fans
blobcaf5fb6ef0e7ec460211916abcd9ad1e3ca3217d
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_idrac_fans(info):
29 for line in info:
30 yield line[0], {}
33 def check_dell_idrac_fans(item, params, info):
34 translate_status = {
35 "1": (3, "OTHER"),
36 "2": (3, "UNKNOWN"),
37 "3": (0, "OK"),
38 "4": (1, "NON CRITICAL UPPER"),
39 "5": (2, "CRITICAL UPPER"),
40 "6": (2, "NON RECOVERABLE UPPER"),
41 "7": (1, "NON CRITICAL LOWER"),
42 "8": (2, "CRITICAL LOWER"),
43 "9": (2, "NON RECOVERABLE LOWER"),
44 "10": (2, "FAILED"),
47 for index, status, value, name, warn_upper, crit_upper, \
48 warn_lower, crit_lower in info:
49 if index == item:
50 state, state_readable = translate_status[status]
51 yield state, "Status: %s, Name: %s" % \
52 (state_readable, name)
54 value = int(value)
55 if not params:
56 params = {'lower': (int(warn_lower), int(crit_lower))}
57 if not warn_upper == "" and \
58 crit_upper == "":
59 params["upper"] = (int(warn_upper), int(crit_upper))
61 yield check_fan(value, params)
64 check_info["dell_idrac_fans"] = {
65 "inventory_function": inventory_dell_idrac_fans,
66 "check_function": check_dell_idrac_fans,
67 "service_description": "Fan %s",
68 "snmp_scan_function":
69 lambda oid: oid('.1.3.6.1.2.1.1.2.0').startswith(".1.3.6.1.4.1.674.10892.5"),
70 "snmp_info": (
71 ".1.3.6.1.4.1.674.10892.5.4.700.12.1",
73 "2", # IDRAC-MIB::coolingDeviceIndex
74 "5", # IDRAC-MIB::coolingDeviceStatus
75 "6", # IDRAC-MIB::coolingDeviceReading
76 "8", # IDRAC-MIB::coolingDeviceLocationName
77 "10", # IDRAC-MIB::coolingDeviceUpperNonCriticalThreshold
78 "11", # IDRAC-MIB::coolingDeviceUpperCriticalThreshold
79 "12", # IDRAC-MIB::coolingDeviceLowerNonCriticalThreshold
80 "13", # IDRAC-MIB::coolingDeviceLowerCriticalThreshold
81 ]),
82 "includes": ["fan.include"],
83 "has_perfdata": True,
84 "group": "hw_fans",