Refactored snapin server_time to new snapin API
[check_mk.git] / checks / dell_om_fans
blob25d741bb1515d9c6e450a8c5fe1abf3384833638
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.
29 def inventory_dell_om_fans(info):
30 for line in info:
31 yield ( line[0], {} )
33 def check_dell_om_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 = {
57 'lower' : (int(warn_lower), int(crit_lower)),
59 if not warn_upper == "" and \
60 crit_upper == "":
61 params["upper"] = (int(warn_upper), int(crit_upper))
63 yield check_fan(value, params)
66 check_info["dell_om_fans"] = {
67 "check_function" : check_dell_om_fans,
68 "inventory_function" : inventory_dell_om_fans,
69 "service_description" : "Fan %s",
70 "snmp_scan_function" : scan_dell_om,
71 "snmp_info" : (".1.3.6.1.4.1.674.10892.1.700.12.1", [
72 "2", # MIB-Dell-10892::coolingDeviceIndex
73 "5", # MIB-Dell-10892::coolingDeviceStatus
74 "6", # MIB-Dell-10892::coolingDeviceReading
75 "8", # MIB-Dell-10892::coolingDeviceLocationName
76 "10", # MIB-Dell-10892::coolingDeviceUpperNonCriticalThreshold
77 "11", # MIB-Dell-10892::coolingDeviceUpperCriticalThreshold
78 "12", # MIB-Dell-10892::coolingDeviceLowerNonCriticalThreshold
79 "13", # MIB-Dell-10892::coolingDeviceLowerCriticalThreshold
80 ]),
81 "includes" : [ "fan.include", "dell_om.include" ],
82 "has_perfdata" : True,
83 "group" : "hw_fans",