Module: check_mk
Branch: master
Commit: a72cfbcb9cda69148fcf44a4d63d94380d7c840d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a72cfbcb9cda69…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Wed Jul 11 14:59:32 2012 +0200
Added check blade_bx_powerfan
---
checks/blade_bx_powerfan | 82 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 82 insertions(+), 0 deletions(-)
diff --git a/checks/blade_bx_powerfan b/checks/blade_bx_powerfan
new file mode 100644
index 0000000..4229cd3
--- /dev/null
+++ b/checks/blade_bx_powerfan
@@ -0,0 +1,82 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2012 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+
+blade_bx_fan_default_error_levels = (50, 40) # percentages or errors!
+
+blade_bx_status = { "1" : "unknow",
+ "2" : "disabled",
+ "3" : "ok",
+ "4" : "fail",
+ "5" : "prefailure-predicted",
+ "6" : "redundant-fan-failed",
+ "7" : "not-manageable",
+ "8" : "not-present",
+ "9" : "not-available" }
+
+def check_blade_bx_powerfan(item, params, info):
+ warn_perc, crit_perc = params
+ for index, status, descr, rpm, max_speed, speed, ctrlstate in info:
+ if descr != item: continue
+ he = 1
+ speedperc = (int(rpm) * 100) / int(max_speed)
+ perfdata=[ ('perc', speedperc, warn_perc, crit_perc, "0",
"100" ),
+ ('rpm', rpm ) ]
+ speedperc_int = saveint(speedperc)
+
+ if ctrlstate != "2":
+ return (2, "CRIT - Fan not present or poweroff", perfdata)
+ elif status != "3":
+ return (2, "CRIT - Status not OK (Status %s)" %
blade_bx_status(status) , perfdata)
+ elif speedperc_int <= crit_perc:
+ return (2, "CRIT - Speed at %d%% of max (crit at %d%%)" %
(speedperc_int, crit_perc), perfdata)
+ elif speedperc_int <= warn_perc:
+ return (1, "WARNING - Speed at %d%% of max (warning at %d%%)" %
(speedperc_int, warn_perc), perfdata)
+ else:
+ return (0, "OK - Speed at %s RPM (%d%% of max)" % (rpm,
speedperc_int), perfdata)
+ return (3, "UNKNOWN - Device %s not found in SNMP data %s " % (item,
perfdata ) )
+
+ return (3, "UNKNOWN - Device %s not found in SNMP data" % item)
+
+
+check_info['blade_bx_powerfan'] = {
+ "check_function" : check_blade_bx_powerfan,
+ "inventory_function" : lambda info: [ (line[2],
"blade_bx_fan_default_error_levels" ) for line in info ] ,
+ "service_description" : "Blade Cooling %s",
+ "has_perfdata" : True,
+ "snmp_info" : (".1.3.6.1.4.1.7244.1.1.1.3.3.1.1", [
+ 1, #index
+ 2, #status
+ 3, #desc
+ 4, #rpm
+ 5, #max_speed
+ 6, #speed
+ 7 # ctrlstate
+
+ ]),
+ "snmp_scan_function" : lambda oid: "BX600" in
oid(".1.3.6.1.2.1.1.1.0"),
+}
+