2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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
["ibm_imm_fan_default_levels"] = {
28 "levels_lower": (28, 25), # Just a guess. Please give feedback.
32 def inventory_ibm_imm_fan(info
):
33 for descr
, speed_text
in info
:
34 if speed_text
.lower() != 'offline':
38 def check_ibm_imm_fan(item
, params
, info
):
39 for descr
, speed_text
in info
:
42 if speed_text
.lower() in ["offline", "unavailable"]:
43 yield 2, "is %s" % speed_text
.lower()
46 # speed_text can be "34 %", or "34%", or "34 % of maximum"
47 # or simply a text without quotes..
48 rpm_perc
= int(speed_text
.strip().replace("[\"%]", " ").replace("%", " ").split(" ")[0])
49 yield 0, "%d%% of max RPM" % rpm_perc
51 warn_lower
, crit_lower
= params
['levels_lower']
52 warn
, crit
= params
.get('levels', (None, None))
55 if rpm_perc
< crit_lower
:
57 elif rpm_perc
< warn_lower
:
62 yield state
, "too low (warn/crit below %d%%/%d%%)" % (warn_lower
, crit_lower
)
67 elif rpm_perc
>= warn
:
72 yield state
, "too high (warn/crit at %d%%/%d%%)" % (warn
, crit
)
76 check_info
["ibm_imm_fan"] = {
77 'check_function' : check_ibm_imm_fan
,
78 'inventory_function' : inventory_ibm_imm_fan
,
79 'service_description' : 'Fan %s',
80 'snmp_scan_function' :
81 lambda oid
: oid('.1.3.6.1.2.1.1.1.0').lower().endswith(" mips") or \
82 oid('.1.3.6.1.2.1.1.1.0').lower().endswith(" sh4a"),
83 'snmp_info' : ('.1.3.6.1.4.1.2.3.51.3.1.3.2.1', [ # fanTable.fanEntry
85 3, # fanSpeed (as text)
87 "default_levels_variable" : "ibm_imm_fan_default_levels",
88 'group' : 'hw_fans_perc',