Module: check_mk
Branch: master
Commit: 46231b8ae6cb91437011331a5a4f1af384a10c65
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=46231b8ae6cb91…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Fri Jul 18 14:46:50 2014 +0200
qlogic_sanbox.psu: New Check for power supplies in QLogic SANbox Fibre Channel Switches
---
.werks/1001 | 8 +++++
ChangeLog | 1 +
checkman/qlogic_sanbox.psu | 17 +++++++++
checks/qlogic_sanbox | 84 +++++++++++++++++++++++++++++++++++++++-----
4 files changed, 102 insertions(+), 8 deletions(-)
diff --git a/.werks/1001 b/.werks/1001
new file mode 100644
index 0000000..070deb4
--- /dev/null
+++ b/.werks/1001
@@ -0,0 +1,8 @@
+Title: qlogic_sanbox.psu: New Check for power supplies in QLogic SANbox Fibre Channel
Switches
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1405687585
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index b7f8f89..dda3d7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,7 @@
* 0181 citrix_sessions, citrix_serverload: New checks for Citrix Load (a Score
calculated by citrix) and the number of sessions
* 0637 jolokia_metrics.gc, jolokia_metrics.tp, jolokia_info: two new subchecks for
the jolokia_metrics checks and better error handling for jolokia_info...
* 1000 qlogic_sanbox.temp: New Check for temperature sensors in QLogic SANbox Fibre
Channel Switches
+ * 1001 qlogic_sanbox.psu: New Check for power supplies in QLogic SANbox Fibre Channel
Switches
* 0994 FIX: agent plugin smart: fixed syntax error
* 0989 FIX: logwatch.ec: Fix forwarding multiple messages via syslog/TCP...
* 0943 FIX: if.include: fixed incorrect traffic percentage values in the check output
of if checks...
diff --git a/checkman/qlogic_sanbox.psu b/checkman/qlogic_sanbox.psu
new file mode 100644
index 0000000..2a3096a
--- /dev/null
+++ b/checkman/qlogic_sanbox.psu
@@ -0,0 +1,17 @@
+title: QLogic SANbox Fibre Channel Switches: Status of Power Supplies
+agents: snmp
+catalog: hw/storagehw/qlogic
+license: GPL
+distribution: check_mk
+description:
+ Checks the status of power supplies in QLogic SANbox Fibre Channel Switches.
+
+ The check returns {OK} if connUnitSensorStatus reports "ok", {WARN} on
+ "warning", {CRIT} on status "failed" and {UNKN} on every other.
+
+item:
+ The ID of the sensor taken from SNMP. It contains 3 numbers separated by
+ dots, e. g. 129.45.1
+
+inventory:
+ Creates one check for every power supply found by SNMP.
diff --git a/checks/qlogic_sanbox b/checks/qlogic_sanbox
index d71eba3..6d2f924 100644
--- a/checks/qlogic_sanbox
+++ b/checks/qlogic_sanbox
@@ -24,12 +24,21 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-qlogic_sanbox_temp_status_map = [ "undefined", # 0
- "unknown", # 1
- "other", # 2
- "ok", # 3
- "warning", # 4
- "failed", ] # 5
+qlogic_sanbox_status_map = [ "undefined", # 0
+ "unknown", # 1
+ "other", # 2
+ "ok", # 3
+ "warning", # 4
+ "failed", ] # 5
+
+# .--temp----------------------------------------------------------------.
+# | _ |
+# | | |_ ___ _ __ ___ _ __ |
+# | | __/ _ \ '_ ` _ \| '_ \ |
+# | | || __/ | | | | | |_) | |
+# | \__\___|_| |_| |_| .__/ |
+# | |_| |
+# '----------------------------------------------------------------------'
def inventory_qlogic_sanbox_temp(info):
inventory = []
@@ -47,10 +56,10 @@ def check_qlogic_sanbox_temp(item, _no_params, info):
sensor_id = sensor_id.replace("16.0.0.192.221.48.",
"").replace(".0.0.0.0.0.0.0.0", "")
if sensor_id == item:
sensor_status = int(sensor_status)
- if sensor_status < 0 or sensor_status >=
len(qlogic_sanbox_temp_status_map):
+ if sensor_status < 0 or sensor_status >=
len(qlogic_sanbox_status_map):
sensor_status_descr = sensor_status
else:
- sensor_status_descr = qlogic_sanbox_temp_status_map[int(sensor_status)]
+ sensor_status_descr = qlogic_sanbox_status_map[int(sensor_status)]
if sensor_status == 3:
status = 0
@@ -84,3 +93,62 @@ check_info["qlogic_sanbox.temp"] = {
OID_END]),
"snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.3873.1.14"),
}
+
+#.
+# .--power supplies------------------------------------------------------.
+# | _ _ |
+# | _ __ _____ _____ _ __ ___ _ _ _ __ _ __ | (_) ___ ___ |
+# || '_ \ / _ \ \ /\ / / _ \ '__| / __| | | | '_ \| '_ \| | |/ _ \/ __|
|
+# || |_) | (_) \ V V / __/ | \__ \ |_| | |_) | |_) | | | __/\__ \ |
+# || .__/ \___/ \_/\_/ \___|_| |___/\__,_| .__/| .__/|_|_|\___||___/ |
+# ||_| |_| |_| |
+# | |
+# '----------------------------------------------------------------------'
+
+def inventory_qlogic_sanbox_psu(info):
+ inventory = []
+ for sensor_name, sensor_status, sensor_message, sensor_type, \
+ sensor_characteristic, sensor_id in info:
+ sensor_id = sensor_id.replace("16.0.0.192.221.48.",
"").replace(".0.0.0.0.0.0.0.0", "")
+ if sensor_type == "5":
+ inventory.append( (sensor_id, None) )
+ return inventory
+
+def check_qlogic_sanbox_psu(item, _no_params, info):
+ for sensor_name, sensor_status, sensor_message, sensor_type, \
+ sensor_characteristic, sensor_id in info:
+ sensor_id = sensor_id.replace("16.0.0.192.221.48.",
"").replace(".0.0.0.0.0.0.0.0", "")
+ if sensor_id == item:
+ sensor_status = int(sensor_status)
+ if sensor_status < 0 or sensor_status >=
len(qlogic_sanbox_status_map):
+ sensor_status_descr = sensor_status
+ else:
+ sensor_status_descr = qlogic_sanbox_status_map[int(sensor_status)]
+
+ if sensor_status == 3:
+ status = 0
+ elif sensor_status == 4:
+ status = 1
+ elif sensor_status == 5:
+ status = 2
+ else:
+ status = 3
+
+ return status, "Power Supply %s reports status %s" % (sensor_id,
sensor_status_descr)
+ return 3, "No sensor %s found" % item
+
+check_info["qlogic_sanbox.psu"] = {
+ "check_function" : check_qlogic_sanbox_psu,
+ "inventory_function" : inventory_qlogic_sanbox_psu,
+ "service_description" : "PSU %s",
+ "has_perfdata" : False,
+ "snmp_info" : (".1.3.6.1.3.94.1.8.1", [3, #
connUnitSensorName
+ 4, # connUnitSensorStatus
+ 6, # connUnitSensorMessage
+ 7, # connUnitSensorType
+ 8, # connUnitSensorCharacteristic
+ OID_END]),
+ "snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.3873.1.14"),
+}
+
+#.