Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / netextreme_fan
blobc4f3ad405a75e8e777bc4700b57bdcf80a2b3cc8
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2015 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 # Just an assumption, levels as in other fan checks
28 factory_settings["netextreme_fan_default_levels"] = {
29 "lower": (2000, 1000),
30 "upper": (8000, 8400),
34 def inventory_netextreme_fan(info):
35 return [(line[0], {}) for line in info]
38 def check_netextreme_fan(item, params, info):
39 map_fan_status = {
40 "1": (0, "on"),
41 "2": (0, "off"),
43 for fan_nr, fan_status, fan_speed_str in info:
44 if fan_nr == item:
45 state, state_readable = map_fan_status[fan_status]
46 yield state, "Operational status: %s" % state_readable
47 if fan_speed_str:
48 yield check_fan(int(fan_speed_str), params)
51 check_info['netextreme_fan'] = {
52 'inventory_function': inventory_netextreme_fan,
53 'check_function': check_netextreme_fan,
54 'service_description': 'Fan %s',
55 'snmp_info': (
56 ".1.3.6.1.4.1.1916.1.1.1.9.1",
58 "1", # extremeFanNumber
59 "2", # extremeFanOperational (TruthValue)
60 "4", # extremeFanSpeed (RPM)
61 ]),
62 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.1916.2"),
63 'has_perfdata': True,
64 'group': 'hw_fans',
65 'default_levels_variable': 'netextreme_fan_default_levels',
66 'includes': ["fan.include"],