Module: check_mk
Branch: master
Commit: cd45ff86e1e13cfd3d8e129c49da1cff7654ff8f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cd45ff86e1e13c…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Jan 28 16:41:48 2011 +0100
three new checks for 3COM switches
---
ChangeLog | 3 ++
checkman/h3c_lanswitch_cpu | 30 +++++++++++++++++++++++++++
checkman/superstack3_sensors | 20 ++++++++++++++++++
checks/h3c_lanswitch_cpu | 33 ++++++++++++++++++++++++++++++
checks/h3c_lanswitch_sensors | 46 ++++++++++++++++++++++++++++++++++++++++++
checks/superstack3_sensors | 23 +++++++++++++++++++++
6 files changed, 155 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6b8edaa..9ade230 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -28,6 +28,9 @@
of an ORACLE instances in the last 60 minutes.
* oracle_tablespaces: new check for monitoring size, state and autoextension
of ORACLE tablespaces.
+ * h3c_lanswitch_cpu: new check for monitoring CPU usage of H3C/HP/3COM switches
+ * h3c_lanswitch_sensors: new check for monitoring hardware sensors of H3C/HP/3COM
switches
+ * superstack3_sensors: new check for monitoring hardware sensors of 3COM Superstack 3
switches
1.1.9i5:
Multisite:
diff --git a/checkman/h3c_lanswitch_cpu b/checkman/h3c_lanswitch_cpu
new file mode 100644
index 0000000..b7256a4
--- /dev/null
+++ b/checkman/h3c_lanswitch_cpu
@@ -0,0 +1,30 @@
+title: Check 3Com SuperStack 4 CPU Utilization
+agents: snmp
+author: Florian Heigl <fh(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This Check queries the CPU utilization for SuperStack 4 switches, either standalone or
that of the CPUs of all units in the stack. Note these switches don't handle snmp well
and you should lower the frequence of SNMP based checks with them.
+ The CPU usage ratio returned by the check is the average load of the last 60 seconds.
+
+
+inventory:
+ The check will add one service per Unit/CPU in a stack.
+
+[parameters]
+warning (int): the percentage of 1-minute average load at which the switch is considered
too busy.
+
+critical (int): the percentage of 1-minute average load at which the switch is considered
overloaded.
+
+
+[configuration]
+superstack4_cpu_default_levels (int, int): the warn and critical levels for the checkl.
+ They are set to default to 50% for "WARN" and 75% for "CRIT".
+
+
+item:
+ The CPU found by inventory (it's OID is a multiple of 65536 and will be divided to
come to a sane value)
+
+
+perfdata:
+ It does not generate any performance data yet.
diff --git a/checkman/superstack3_sensors b/checkman/superstack3_sensors
new file mode 100644
index 0000000..65ead22
--- /dev/null
+++ b/checkman/superstack3_sensors
@@ -0,0 +1,20 @@
+title: Check 3Com SuperStack 3 Hardware / FRU sensors
+agents: snmp
+author: Florian Heigl <fh(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check queries the snmp sensors for internal and addon modules
+ of 3Com SuperStack 3 switches. It can notify you of a fan or add-on module failure.
+
+ It will generate OK status for any item that shows "operational" via SNMP,
CRIT any that is in "failure" state and "warning" in all other
states.
+
+
+item:
+ The description of the sensor as provided by the device.
+
+inventory:
+ One service is created for each item found in the switch.
+
+perfdata:
+ It does not generate any performance data as the info from the switches is just
textual.
diff --git a/checks/h3c_lanswitch_cpu b/checks/h3c_lanswitch_cpu
new file mode 100644
index 0000000..5422d7a
--- /dev/null
+++ b/checks/h3c_lanswitch_cpu
@@ -0,0 +1,33 @@
+
+
+# Reasonably low warning and crit levels
+h3c_lanswitch_cpu_default_levels = (50, 75)
+
+
+def inventory_h3c_lanswitch_cpu(checkname, info):
+ return [ ( int(line[0]) / 65536 , "h3c_lanswitch_cpu_default_levels" ) for
line in info ]
+
+def check_h3c_lanswitch_cpu(item, params, info):
+ warn, crit = params
+ for line in info:
+ unitid = int(line[0]) / 65536
+ if unitid == item:
+ util = int(line[1])
+ if util > crit:
+ return (2, "CRIT - Unit %d Utilization: %s%%" % (unitid, util)
)
+ elif util > warn:
+ return (1, "WARN - Unit %d Utilization: %s%%" % (unitid, util)
)
+ else:
+ return (0, "OK - Unit %d Utilization: %s%%" % (unitid, util) )
+ return (3, "UNKNOWN - Unit/CPU %s not found" % item)
+
+
+check_info["h3c_lanswitch_cpu"] = (check_h3c_lanswitch_cpu, "Unit CPU Util
%s", 0, inventory_h3c_lanswitch_cpu )
+
+snmp_info["h3c_lanswitch_cpu"] = \
+ ( "1.3.6.1.4.1.43.45.1.6.1.1.1", [ OID_END, "3" ] )
+
+
+snmp_scan_functions["h3c_lanswitch_cpu"] = \
+ lambda oid: "3com superstack 4" in oid
(".1.3.6.1.2.1.1.1.0").lower()
+# alternatively: 3Com Switch 8814
diff --git a/checks/h3c_lanswitch_sensors b/checks/h3c_lanswitch_sensors
new file mode 100644
index 0000000..4855f95
--- /dev/null
+++ b/checks/h3c_lanswitch_sensors
@@ -0,0 +1,46 @@
+def inventory_h3c_lanswitch_sensors(checkname, info):
+ return [ (h3c_lanswitch_genitem(line[0]), None) for line in info if line[1] in [
'1', '2'] ]
+
+
+
+def check_h3c_lanswitch_sensors(item, params, info):
+# the values are: active (1), deactive (2), not-install (3), unsupport (4)
+ for (endoid, status) in info:
+ if h3c_lanswitch_genitem(endoid) == item:
+ if status == "2":
+ return (2, "CRIT - Sensor %s status is %s" % (item, status))
+ elif status == "1":
+ return (0, "OK - Sensor %s status is %s" % (item, status))
+ else:
+ return (1, "WARN - Sensor % status is %s" % (item, status))
+ return (3, "UNKNOWN - Sensor %s not found" % item )
+
+
+check_info["h3c_lanswitch_sensors"] = (check_h3c_lanswitch_sensors,
"%s", 0, inventory_h3c_lanswitch_sensors )
+
+def h3c_lanswitch_genitem(endoid):
+ deviceclass, one, id = endoid.split(".")
+# print ("%s %s %s" % (deviceclass, one, id))
+ if deviceclass == "1":
+ hwLswdev = "Fan"
+ else:
+ hwLswdev = "Powersupply"
+ unitid = int(id) / 65536
+ num = int(id) % 65536
+ return "Unit %d %s %d" % (unitid, hwLswdev, num)
+
+
+# mib: A3COM-HUAWEI-LswDEVM-MIB
+# fan table: A3COM-HUAWEI-OID-MIB::lswCommon.9.1.1.1.1.65536 = INTEGER: 65536
+# fan status: A3COM-HUAWEI-OID-MIB::lswCommon.9.1.1.1.2.65536 = INTEGER: 1
+# hwdevMPowerStatusTable ( hwDevMPowerNum, hwDevMPowerStatus )
+# hwdevMFanStatusTable
+#
+#
+# finally,just check fan status
+snmp_info["h3c_lanswitch_sensors"] = \
+ ( ".1.3.6.1.4.1.43.45.1.2.23.1.9.1", ["1.1", "2.1"], [
OID_END, "2" ] )
+
+
+snmp_scan_functions["h3c_lanswitch_sensors"] = \
+ lambda oid: "3com switch 5500" in oid
(".1.3.6.1.2.1.1.1.0").lower()
diff --git a/checks/superstack3_sensors b/checks/superstack3_sensors
new file mode 100644
index 0000000..92013dd
--- /dev/null
+++ b/checks/superstack3_sensors
@@ -0,0 +1,23 @@
+def inventory_superstack3_sensors(checkname, info):
+ return [ (line[0], None) for line in info if line[1] != 'not present' ]
+
+def check_superstack3_sensors(item, params, info):
+ for name, state in info:
+ if name == item:
+ if state == "failure":
+ return (2, "CRIT - status is %s" % state )
+ elif state == "operational":
+ return (0, "OK - status is %s" % state )
+ else:
+ return (1, "WARN - status is %s" % state )
+ return (3, "UNKOWN - sensor not found")
+
+
+check_info["superstack3_sensors"] = (check_superstack3_sensors, "%s",
0, inventory_superstack3_sensors )
+
+snmp_info["superstack3_sensors"] = \
+ ( "1.3.6.1.4.1.43.43.1.1", [ "7", "10" ] )
+
+
+snmp_scan_functions["superstack3_sensors"] = \
+ lambda oid: "3com superstack 3" in oid
(".1.3.6.1.2.1.1.1.0").lower()