Module: check_mk
Branch: master
Commit: 8aa748d2a6fadca613d474a0019373424e3659ae
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8aa748d2a6fadc…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Mar 1 15:52:36 2018 +0100
Minor cleanup
Change-Id: Id0d293bfaeae1a6985187a6523aea735100870ba
---
checkman/adva_fsp_current | 8 +++----
checkman/huawei_osn_fan | 7 +++---
checks/adva_fsp_current | 45 +++++++++++++++++++++----------------
checks/blade_bx_blades | 56 +++++++++++++++++++++++++++++------------------
checks/watchdog_sensors | 18 ++++++---------
5 files changed, 75 insertions(+), 59 deletions(-)
diff --git a/checkman/adva_fsp_current b/checkman/adva_fsp_current
index 07af411..db87f18 100644
--- a/checkman/adva_fsp_current
+++ b/checkman/adva_fsp_current
@@ -7,10 +7,10 @@ description:
This checks monitors the current measured for power supplies of the
ADVA FSP 3000 scalable optical transport solution.
- No limits are set in the check, since limits are configured in the
- device itself. The upper limit for the current is
- read from the device. If the current value is outside the allowed
- range the check is {CRIT}, otherwise it is {OK}.
+ No thresholds are set in the check, since thresholds are configured in the
+ device itself. The upper threshold for the current is
+ read from the device. If the current value is above the threshold
+ the check is {CRIT}, otherwise it is {OK}.
item:
The name of the power supply module
diff --git a/checkman/huawei_osn_fan b/checkman/huawei_osn_fan
index 133ac4f..f354013 100644
--- a/checkman/huawei_osn_fan
+++ b/checkman/huawei_osn_fan
@@ -1,14 +1,13 @@
-title: Huawei OSN: Fans
+title: Huawei OptiX OSN: Fans
agents: snmp
catalog: hw/network/huawei
license: GPL
distribution: check_mk
description:
- This check monitors the state of fans. The state will change to {WARN}
- if the reported value for the fan speed is "stopped" or "high".
+ This check monitors the state of Huawei OSN OptiX fans.
item:
- The fan BID is the item
+ The fan board slot ID.
inventory:
One service for each fan is created
diff --git a/checks/adva_fsp_current b/checks/adva_fsp_current
index aef08d7..d3544ec 100644
--- a/checks/adva_fsp_current
+++ b/checks/adva_fsp_current
@@ -24,32 +24,40 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
+# .1.3.6.1.4.1.2544.1.11.2.4.2.2.1.1.101318912 8110
+# .1.3.6.1.4.1.2544.1.11.2.4.2.2.1.2.101318912 65600
+# .1.3.6.1.4.1.2544.1.11.2.4.2.2.1.3.101318912 9
+# .1.3.6.1.4.1.2544.2.5.5.1.1.1.101318912 "PSU/7HU-AC-800"
+# .1.3.6.1.4.1.2544.2.5.5.1.1.5.101318912 "MOD-1-1"
+
+
def inventory_adva_fsp_current(info):
- inventory = []
- for line in info:
+ for current_str, upper_threshold_str, power_str, \
+ unit_name, index_aid in info:
# Ignore non-connected sensors
- if len(line) == 5 and line[4] != "" and line[2] != "":
- inventory.append( (line[4], None) )
- return inventory
+ if index_aid != "" and power_str != "":
+ yield index_aid, None
+
def check_adva_fsp_current(item, _no_params, info):
- for line in info:
- if len(line) == 5 and line[4] == item:
- current, high, power, descr = line[0:4]
- current = float(current) / 1000.0
- high = float(high) / 1000
+ for current_str, upper_threshold_str, power_str, \
+ unit_name, index_aid in info:
+ if index_aid == item:
+ current = float(current_str) / 1000.0
+ upper_threshold = float(upper_threshold_str) / 1000
- infotext = "%.3f A (limit at %.3f A) at %s" % (current, high,
descr)
- perfdata = [ ("current", current, "", str(high), ) ]
+ infotext = "[%s] %.3f A (crit at %.3f A)" % (
+ unit_name, current, upper_threshold)
+ perfdata = [("current", current, None, upper_threshold,)]
if current <= 0:
- return(3, "Invalid Sensor Data")
- elif current >= high:
- return (2, "%s" % infotext, perfdata)
+ return 3, "Invalid sensor data"
+ elif current >= upper_threshold:
+ return 2, infotext, perfdata
else:
- return (0, "%s" % infotext, perfdata)
+ return 0, infotext, perfdata
- return (3, "Sensor %s not found in SNMP data" % item)
check_info['adva_fsp_current'] = {
"inventory_function" : inventory_adva_fsp_current,
@@ -63,6 +71,5 @@ check_info['adva_fsp_current'] = {
"2.5.5.1.1.1", # inventoryUnitName
"2.5.5.2.1.5", # entityIndexAid
]),
- "snmp_scan_function" : lambda oid:
- oid(".1.3.6.1.2.1.1.1.0") == "Fiber
Service Platform F7",
+ "snmp_scan_function" : lambda oid: oid(".1.3.6.1.2.1.1.1.0")
== "Fiber Service Platform F7",
}
diff --git a/checks/blade_bx_blades b/checks/blade_bx_blades
index 5969a1f..137f3d4 100644
--- a/checks/blade_bx_blades
+++ b/checks/blade_bx_blades
@@ -24,29 +24,43 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-def check_blade_bx_blades(item, no_params, info):
- blade_status_codes = { 1 : "Unknown", 2 : "OK", 3 :
"not-present", 4 : "Error", 5 : "Critical", 6 :
"Standby" }
- for blade_id, blade_status, blade_serial, blade_name in info:
- state = 0
- blade_status = saveint(blade_status)
- if blade_id == item:
- if blade_status == 4 or blade_status == 5:
- state = 2
- return (state, "Blade %s %s %s Status %s " % (blade_id, blade_name,
blade_serial, blade_status_codes.get(blade_status, 1)))
+def inventory_blade_bx_blades(info):
+ for id_, status, serial, name in info:
+ if status != "3": # blade not present
+ yield id_, None
+
+
+def check_blade_bx_blades(item, _no_params, info):
+ status_codes = {
+ "1": (3, "unknown"),
+ "2": (0, "OK"),
+ "3": (3, "not present"),
+ "4": (2, "error"),
+ "5": (2, "critical"),
+ "6": (0, "standby"),
+ }
+
+ for id_, status, serial, name in info:
+ if id_ == item:
+ state, state_readable = status_codes[status]
+ if name:
+ name_info = "[%s, Serial: %s]" % (name, serial)
+ else:
+ name_info = "[Serial: %s]" % serial
+ return state, "%s Status: %s" % (name_info, state_readable)
- return (3, "no data for '%s' in SNMP info" % item)
check_info['blade_bx_blades'] = {
- "check_function" : check_blade_bx_blades,
- "inventory_function" : lambda info: [ (line[0], None) for line in info if
int(line[1]) != 3] ,
- "service_description" : "Blade %s",
- "snmp_info" : (".1.3.6.1.4.1.7244.1.1.1.4.2.1.1", [
- 1, # bladeId
- 2, # bladestatus
- 5, # Serialnumber
- 21, # Name
- ]),
- "snmp_scan_function" : lambda oid: "BX600" in
oid(".1.3.6.1.2.1.1.1.0") \
- or oid(".1.3.6.1.2.1.1.2.0") ==
".1.3.6.1.4.1.7244.1.1.1",
+ "inventory_function" : inventory_blade_bx_blades,
+ "check_function" : check_blade_bx_blades,
+ "service_description" : "Blade %s",
+ "snmp_info" : (".1.3.6.1.4.1.7244.1.1.1.4.2.1.1", [
+ 1, # bladeId
+ 2, # bladestatus
+ 5, # Serialnumber
+ 21, # Name
+ ]),
+ "snmp_scan_function" : lambda oid: "BX600" in
oid(".1.3.6.1.2.1.1.1.0") \
+ or oid(".1.3.6.1.2.1.1.2.0") ==
".1.3.6.1.4.1.7244.1.1.1",
}
diff --git a/checks/watchdog_sensors b/checks/watchdog_sensors
index aa6a453..11b2d62 100644
--- a/checks/watchdog_sensors
+++ b/checks/watchdog_sensors
@@ -165,18 +165,15 @@ check_info['watchdog_sensors'] = {
def inventory_watchdog_sensors_temp(parsed):
for key in parsed:
- yield ( key, {} )
+ yield (key, {})
-def check_watchdog_sensors_temp(item, params, parsed):
- for key in parsed:
- if key == item:
- data = parsed[key]
- temperature = float(data['temp'][0])/10.0
- unit = data['temp'][1]
- if unit == "F":
- temperature = 5.0/9.0*(temperature-32)
- yield check_temperature(temperature, params,
"check_watchdog_sensors.%s" % item)
+def check_watchdog_sensors_temp(item, params, parsed):
+ if item in parsed:
+ temperature_str, unit = parsed[item]['temp']
+ return check_temperature(float(temperature_str) / 10.0, params,
+ "check_watchdog_sensors.%s" % item,
+ dev_unit=unit.lower())
check_info['watchdog_sensors.temp'] = {
@@ -187,7 +184,6 @@ check_info['watchdog_sensors.temp'] = {
'group' : 'temperature',
}
-
#.
# .--humidity------------------------------------------------------------.
# | _ _ _ _ _ |