Module: check_mk
Branch: master
Commit: d190b6a1d4e28652709bff2848b08718e59fab2e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d190b6a1d4e286…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Wed Feb 11 16:05:50 2015 +0100
netscaler_health: now uses fan.include. Fixed bug in fan.include
---
checks/fan.include | 4 ++--
checks/netscaler_health | 23 ++---------------------
2 files changed, 4 insertions(+), 23 deletions(-)
diff --git a/checks/fan.include b/checks/fan.include
index 02782be..76741ae 100644
--- a/checks/fan.include
+++ b/checks/fan.include
@@ -37,10 +37,10 @@ def check_fan(rpm, params):
" and at or above %s/%s rpm)" % (warn_upper, crit_upper)
# Note that None < int
- if rpm < crit or rpm >= crit_upper:
+ if rpm < crit or crit_upper != None and rpm >= crit_upper:
message += levelstext
return 2, message
- elif rpm < warn or rpm >= warn_upper:
+ elif rpm < warn or warn_upper != None and rpm >= warn_upper:
message += levelstext
return 1, message
else:
diff --git a/checks/netscaler_health b/checks/netscaler_health
index c6b7624..b763197 100644
--- a/checks/netscaler_health
+++ b/checks/netscaler_health
@@ -74,27 +74,7 @@ def inventory_netscaler_health_fan(info):
def check_netscaler_health_fan(item, params, info):
for name, value in info:
if name[:-5] == item:
- value=int(value)
- infotext = "speed is %d rpm" % value
-
- state = 0
- lower_warn, lower_crit = params["lower"]
- upper_warn, upper_crit = params["upper"]
- if lower_crit and value <= lower_crit:
- state = 2
- infotext += " (lower levels at %d/%d rpm)" % (lower_warn,
lower_crit)
- elif lower_warn and value <= lower_warn:
- state = 1
- infotext += " (lower levels at %d/%d rpm)" % (lower_warn,
lower_crit)
- elif upper_crit and value >= upper_crit:
- state = 2
- infotext += " (upper levels at %d/%d rpm)" % (upper_warn,
upper_crit)
- elif upper_warn and value >= upper_warn:
- state = 1
- infotext += " (upper levels at %d/%d rpm)" % (upper_warn,
upper_crit)
-
- return state, infotext
-
+ return check_fan(int(value), params)
check_info["netscaler_health.fan"] = {
"check_function" : check_netscaler_health_fan,
@@ -104,6 +84,7 @@ check_info["netscaler_health.fan"] = {
"snmp_info" : netscaler_health_info,
"snmp_scan_function" : netscaler_health_scan,
"default_levels_variable" :
"netscaler_health_fan_default_levels",
+ "includes" : [ "fan.include" ],
}
#.
# .--temp----------------------------------------------------------------.