Module: check_mk
Branch: master
Commit: 580a55025d0e683a0696bf9d2e570e5c3c102a7c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=580a55025d0e68…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Jan 7 14:52:26 2016 +0100
#1319 blade_bx_powerfan: Check can now be configured using Wato
---
.werks/1319 | 9 +++++++++
ChangeLog | 1 +
checks/blade_bx_powerfan | 38 +++++++++++++++++++++++++-------------
3 files changed, 35 insertions(+), 13 deletions(-)
diff --git a/.werks/1319 b/.werks/1319
new file mode 100644
index 0000000..e8b4bee
--- /dev/null
+++ b/.werks/1319
@@ -0,0 +1,9 @@
+Title: blade_bx_powerfan: Check can now be configured using Wato
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1452174725
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index aa75dc6..22e401e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -69,6 +69,7 @@
* 2817 cmc_temp: New temperature check for Rittal devices using the CMC MIB
* 1600 check_mk_agent.linux: Diskstat Sektion now supports s390 DASDs (zLinux on IBM
Mainframes)
* 1318 cisco_asa_svcsessions: New Check to monitor VPN Connections on Cisco ASA
devices
+ * 1319 blade_bx_powerfan: Check can now be configured using Wato
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/checks/blade_bx_powerfan b/checks/blade_bx_powerfan
index 9ddcc0d..0a90044 100644
--- a/checks/blade_bx_powerfan
+++ b/checks/blade_bx_powerfan
@@ -24,9 +24,15 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-
+# For legacy reasons
blade_bx_fan_default_error_levels = (20, 10) # percentages or errors!
+factory_settings['blade_bx_powerfan_default_levels'] = {
+ "levels_lower" : ( 20, 10 ),
+ "levels" : ( 80, 90 ),
+
+}
+
blade_bx_status = { "1" : "unknow",
"2" : "disabled",
"3" : "ok",
@@ -40,10 +46,16 @@ blade_bx_status = { "1" : "unknow",
def inventory_blade_bx_powerfan(info):
for line in info:
if line[1] != "8":
- yield line[2], "blade_bx_fan_default_error_levels"
+ yield line[2],{}
def check_blade_bx_powerfan(item, params, info):
- warn_perc, crit_perc = params
+ if type(params) == dict:
+ warn_perc, crit_perc = params['levels']
+ warn_perc_up, crit_perc_up = params['levels_lower']
+ else:
+ warn_perc, crit_perc = params
+ warn_perc_up, crit_perc_up = None, None
+
for index, status, descr, rpm, max_speed, speed, ctrlstate in info:
if descr != item: continue
he = 1
@@ -56,22 +68,22 @@ def check_blade_bx_powerfan(item, params, info):
return (2, "Fan not present or poweroff", perfdata)
elif status != "3":
return (2, "Status not OK (Status %s)" % blade_bx_status[status] ,
perfdata)
- elif speedperc_int <= crit_perc:
- return (2, "Speed at %d%% of max (crit at %d%%)" % (speedperc_int,
crit_perc), perfdata)
- elif speedperc_int <= warn_perc:
- return (1, "Speed at %d%% of max (warning at %d%%)" %
(speedperc_int, warn_perc), perfdata)
+ elif speedperc_int <= crit_perc or (crit_perc_up and speedperc_int >=
crit_perc_up):
+ return 2, "Speed at %d%% of max (crit at < %d%% or > %d%%)" %
(speedperc_int, crit_perc, crit_perc_up ), perfdata
+ elif speedperc_int <= warn_perc or (warn_perc and speedperc_int >=
warn_perc_up):
+ return 1, "Speed at %d%% of max (warning at < %d%% > %d%%)" %
(speedperc_int, warn_perc, warn_perc_up), perfdata
else:
return (0, "Speed at %s RPM (%d%% of max)" % (rpm, speedperc_int),
perfdata)
- return (3, "Device %s not found in SNMP data %s " % (item, perfdata )
)
- return (3, "Device %s not found in SNMP data" % item)
check_info['blade_bx_powerfan'] = {
- "check_function" : check_blade_bx_powerfan,
- "inventory_function" : inventory_blade_bx_powerfan,
- "service_description" : "Blade Cooling %s",
- "has_perfdata" : True,
+ "check_function" : check_blade_bx_powerfan,
+ "inventory_function" : inventory_blade_bx_powerfan,
+ "service_description" : "Blade Cooling %s",
+ "has_perfdata" : True,
+ "group" : "hw_fans_perc",
+ "default_levels_variable" : "blade_bx_powerfan_default_levels",
"snmp_info" : (".1.3.6.1.4.1.7244.1.1.1.3.3.1.1", [
1, #index
2, #status