Module: check_mk
Branch: master
Commit: c05364ab77d301fea49d237ffbc7b48554e8387e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c05364ab77d301…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Tue Mar 17 11:18:01 2015 +0100
ibm_imm_fan: code rewrite, no more perfdata, hardcoded levels
---
checkman/ibm_imm_fan | 13 +++++--------
checks/ibm_imm_fan | 46 ++++++++++++++++++++--------------------------
2 files changed, 25 insertions(+), 34 deletions(-)
diff --git a/checkman/ibm_imm_fan b/checkman/ibm_imm_fan
index 653eec4..c7ce6c3 100644
--- a/checkman/ibm_imm_fan
+++ b/checkman/ibm_imm_fan
@@ -4,18 +4,15 @@ catalog: hw/server/ibm
license: GPL
distribution: check_mk
description:
- This check monitors the rpms of fans via a IBM Integrated Management Module
- (IMM). It uses snmp and the IBM IMM MIB to gather and interpret the fan data.
+ This check monitors the percentage of maximum RPM of fans via the IBM
+ Integrated Management Module (IMM). It uses snmp and the IBM IMM MIB to
+ gather the fan data.
- The check uses the lower warning and critical levels extracted from the
- device (OIDs {fanCritLimitLow}, {fanNonCritLimitLow}) to calculate the state
- of the service.
+ The check uses hardcoded lower warning and critical levels of (28%,25%)
+ to calculate the state of the service.
inventory:
The service discovery will find one service per fan
item:
The name of the fan as extracted from the OID {fanDescr}
-
-perfdata:
- The RPM of the fan
diff --git a/checks/ibm_imm_fan b/checks/ibm_imm_fan
index ebe47ba..898567b 100644
--- a/checks/ibm_imm_fan
+++ b/checks/ibm_imm_fan
@@ -24,53 +24,47 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
def inventory_ibm_imm_fan(info):
- for line in info:
- yield line[0], None
+ for descr, speed in info:
+ if speed.lower() != 'offline':
+ yield descr, {}
def check_ibm_imm_fan(item, _no_params, info):
- for line in info:
- if line[0] == item:
- # values are rpm in percent to max rpm
- rpm = int(line[1].split(" ")[0])
- dev_crit_lower, dev_warn_lower = map(lambda rpm: int(rpm)/10.0, line[2:-1])
- status = line[-1]
- infotext = "%d%% of max rpm" % rpm
- if status:
- infotext =+ ", Status: %s" % status
- perfdata = [ ("rpm", str(rpm)+"%",
str(dev_warn_lower)+":", \
- str(dev_crit_lower)+":") ]
- levelstext = " (warn/crit lower levels: %d%%/%d%%)" %
(dev_warn_lower, dev_crit_lower)
- if rpm <= dev_crit_lower:
+ for descr, speed in info:
+ if descr == item:
+
+ if speed.lower() == "offline":
+ return 2, "is offline"
+
+ # speed can be "34 %", or "34%", or "34 % of
maximum"
+ rpm_perc = int(speed.replace("%", " ").split("
")[0])
+ infotext = "%d%% of max rpm" % rpm_perc
+
+ warn, crit = (28, 25) # preliminary estimates of levels
+ levelstext = " (warn/crit at %d%%/%d%%)" % (warn,crit)
+
+ if rpm_perc <= crit:
state = 2
infotext += levelstext
- elif rpm<= dev_warn_lower:
+ elif rpm_perc <= warn:
state = 1
infotext += levelstext
else:
state = 0
- return state, infotext, perfdata
+ return state, infotext
check_info["ibm_imm_fan"] = {
'check_function' : check_ibm_imm_fan,
'inventory_function' : inventory_ibm_imm_fan,
'service_description' : 'Fan %s',
- 'has_perdata' : True,
'snmp_scan_function' :
lambda oid: oid('.1.3.6.1.2.1.1.1.0').lower().endswith("
mips") or \
oid('.1.3.6.1.2.1.1.1.0').lower().endswith("
sh4a"),
'snmp_info' : ('.1.3.6.1.4.1.2.3.51.3.1.3.2.1', [ #
fanTable.fanEntry
- #1, # fanIndex
2, # fanDescr
3, # fanSpeed
- #4, # fanNonRecovLimitHigh
- #5, # fanCritLimitHigh
- #6, # fanNonCritLimitHigh
- #7, # fanNonRecovLimitLow
- 8, # fanCritLimitLow
- 9, # fanNonCritLimitLow
- 10, # fanHealthStatus
]),
}