Module: check_mk
Branch: master
Commit: 8fd4c4c0d87340369e7b6d3a0407fafbdcaf4c8a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8fd4c4c0d87340…
Author: Götz Golla <gg(a)mathias-kettner.de>
Date: Wed Oct 23 16:13:02 2013 +0200
Check added for the fan state and rpm of genuscreen firewalls
---
checkman/genua_fan | 37 +++++++++++++++++++++++++
checks/genua_fan | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 115 insertions(+)
diff --git a/checkman/genua_fan b/checkman/genua_fan
new file mode 100644
index 0000000..3c4b58b
--- /dev/null
+++ b/checkman/genua_fan
@@ -0,0 +1,37 @@
+title: Check for fan state and rpm on genua devices
+agents: snmp
+catalog: hw/network/genua
+license: GPL
+distribution: check_mk
+description:
+ This check monitors the state and rpm of fans found on genuscreen firewalls.
+ Lower and upper levels for the rpm may be given.
+
+ The check is known to run with genuscreen version 3.0 and 4.1, and supports
+ genuas regular enterprise id 3717 as well as the id 3137 which was
+ introduced in a bug in some versions of genuscreen.
+
+perfdata:
+ The rpm of the fans
+
+inventory:
+ The inventory process checks if the device has a system description OID
+ of .1.3.6.1.2.1.1.2.0 and if the name of this OID contains "genuscreen"
+ (case insensitive).
+ If this is true and a fan is found, then the it is inventorized.
+
+item:
+ The name of the fan according to the snmp output
+
+[parameters]
+parameters(dict): parameters is a dictionary with two keys
+
+ {"lower"}: a tuple of lower warning and critical values for the fan rpm
+
+ {"upper"}: a tuple of upper warning and critical values for the fan rpm
+
+[configuration]
+genua_fan_default_levels(dict): This variable is preset to
+
+ {{ "lower": ( 2000, 1000), "upper": (8000, 8400) }}
+
diff --git a/checks/genua_fan b/checks/genua_fan
new file mode 100644
index 0000000..50eecc3
--- /dev/null
+++ b/checks/genua_fan
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+
+# Warning- und Criticalwerte (u/min)
+genua_fan_default_levels = { "lower": ( 2000, 1000), "upper": (8000,
8400) }
+
+def inventory_genua_fan(info):
+ # remove empty elements due to alternative enterprise id in snmp_info
+ info = filter(None, info)
+
+ inventory = []
+ for fanNo, fanName, fanRPM, fanState in info[0]:
+ inventory.append( (fanName, "genua_fan_default_levels") )
+ return inventory
+
+def check_genua_fan(item, params, info):
+
+ # remove empty elements due to alternative enterprise id in snmp_info
+ info = filter(None, info)
+
+ fanStateStr = { "1":"OK", "2":"Warning",
"3":"Critical",
+ "4":"Unkown",
"5":"Unkown", "6":"Unkown"}
+
+ lowerwarn, lowercrit = params["lower"]
+ upperwarn, uppercrit = params["upper"]
+ for line in info[0]:
+ fanNo, fanName, fanRPM, fanState = line
+ if fanName != item: continue
+
+ rpm = saveint(fanRPM)
+
+ if rpm > uppercrit or rpm < lowercrit:
+ rpmstate = 2
+ rpmsym = "(!!)"
+ elif rpm > upperwarn or rpm < lowerwarn:
+ rpmstate = 1
+ rpmsym = "(!)"
+ else:
+ rpmstate = 0
+ rpmsym = ""
+
+ if fanState in ( "3", "4", "5", "6"
):
+ statestate = 2
+ statesym = "(!!)"
+ elif fanState == "2":
+ statestate = 1
+ statesym = "(!)"
+ else:
+ statestate = 0
+ statesym = ""
+
+ perfdata = [ ( 'rpm', fanRPM, upperwarn, uppercrit, 0, uppercrit ) ]
+ infotext = "State: %s %s, RPM: %s %s" % \
+ (fanStateStr[fanState], statesym, fanRPM, rpmsym)
+ state = max(statestate,rpmstate)
+ return (state, infotext, perfdata)
+
+ return (3, "UNKNOWN - FAN %s not found in SNMP data" % item)
+
+check_info['genua_fan'] = {
+ "inventory_function" : inventory_genua_fan,
+ "check_function" : check_genua_fan,
+ "service_description": "FAN %s",
+ "has_perfdata" : True,
+ "snmp_info" : [( ".1.3.6.1.4.1.3717.2.1.1.1.1",[
+ "1", # "fanNo"
+ "2", # "fanName"
+ "3", # "fanRPM"
+ "4" # "fanState"
+ ]),
+ ( ".1.3.6.1.4.1.3137.2.1.1.1.1",[
+ "1", # "fanNo"
+ "2", # "fanName"
+ "3", # "fanRPM"
+ "4" # "fanState"
+ ])],
+ "snmp_scan_function" : lambda oid: "genuscreen" in
oid(".1.3.6.1.2.1.1.1.0").lower()
+}