Module: check_mk
Branch: master
Commit: 032cf437868fe0b24a19055429ba093232775073
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=032cf437868fe0…
Author: Florian Heigl <fh(a)mathias-kettner.de>
Date: Fri Mar 4 14:14:41 2011 +0100
fixed indentation
---
checks/h3c_lanswitch_cpu | 20 +++++++++-----------
checks/h3c_lanswitch_sensors | 26 +++++++++++++-------------
checks/superstack3_sensors | 14 +++++++-------
3 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/checks/h3c_lanswitch_cpu b/checks/h3c_lanswitch_cpu
index bb634c3..280f5fc 100644
--- a/checks/h3c_lanswitch_cpu
+++ b/checks/h3c_lanswitch_cpu
@@ -26,7 +26,7 @@
# Example output of multi-unit stack (SS5500-EL, etc):
# SNMPv2-SMI::enterprises.43.45.1.6.1.1.1.3.65536 = Gauge32: 11
-#
+#
# Example outpout of multi-slot switche (SS8800 etc):
# SNMPv2-SMI::enterprises.43.45.1.6.1.1.1.3.0 = Gauge32: 11
# [...]
@@ -39,7 +39,7 @@ switch_cpu_default_levels = (50, 75)
# We do not want to use the end OID as item since.
# We prefer "Switch 1 CPU 1" over "65537"...
-def h3c_lanswitch_cpu_genitem(item):
+def h3c_lanswitch_cpu_genitem(item):
# decide switch class here (stacked or standalone/modular)
cpuid = int(item)
@@ -75,26 +75,24 @@ def check_h3c_lanswitch_cpu(item, params, info):
infotext = (" - average usage was %d%% over last 5 minutes." %
util)
perfdata = [ ( "usage", util, warn, crit, 0, 100) ]
- if util > crit:
+ if util > crit:
return (2, "CRIT" + infotext, perfdata)
elif util > warn:
return (1, "WARN" + infotext, perfdata)
- else:
+ else:
return (0, "OK" + infotext, perfdata)
return (3, "UNKNOWN - %s not found" % item)
-
check_info["h3c_lanswitch_cpu"] = (check_h3c_lanswitch_cpu, "CPU
Utilization %s", 1, 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" # 5-min average load.
- ])
+ ( "1.3.6.1.4.1.43.45.1.6.1.1.1", [
+ OID_END,
+ "3" # 5-min average load.
+ ])
-# just a rough match that will handle most devices.
+# just a rough match that will handle most devices.
snmp_scan_functions["h3c_lanswitch_cpu"] = \
lambda oid: oid(".1.3.6.1.2.1.1.1.0").lower().startswith('3com s')
-
diff --git a/checks/h3c_lanswitch_sensors b/checks/h3c_lanswitch_sensors
index 125fb77..64c18b8 100644
--- a/checks/h3c_lanswitch_sensors
+++ b/checks/h3c_lanswitch_sensors
@@ -33,35 +33,35 @@ 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":
+ 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 )
+ 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(".")
+ 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)
-
+ 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"] = \
@@ -69,4 +69,4 @@ snmp_info["h3c_lanswitch_sensors"] = \
snmp_scan_functions["h3c_lanswitch_sensors"] = \
- lambda oid: "3com switch 5500" in oid
(".1.3.6.1.2.1.1.1.0").lower()
+ 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
index b6a354e..37bbe51 100644
--- a/checks/superstack3_sensors
+++ b/checks/superstack3_sensors
@@ -30,20 +30,20 @@ def inventory_superstack3_sensors(checkname, info):
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 )
+ 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")
+ 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" ] )
+ ( "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()
+ lambda oid: "3com superstack 3" in oid
(".1.3.6.1.2.1.1.1.0").lower()