Module: check_mk
Branch: master
Commit: 3a370ba38e913255a0d17daa98fa2cecfd84c336
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3a370ba38e9132…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Mon Jul 7 13:04:23 2014 +0200
raritan_pdu_inlet: now also monitors the three phases of the inlet
---
.werks/628 | 8 ++++
ChangeLog | 1 +
checkman/raritan_pdu_inlet | 2 +-
checks/raritan_pdu_inlet | 81 ++++++++++++++++++++++--------------
web/plugins/perfometer/check_mk.py | 16 +++----
5 files changed, 68 insertions(+), 40 deletions(-)
diff --git a/.werks/628 b/.werks/628
new file mode 100644
index 0000000..87badd3
--- /dev/null
+++ b/.werks/628
@@ -0,0 +1,8 @@
+Title: raritan_pdu_inlet: now also monitors the three phases of the inlet
+Level: 1
+Component: checks
+Version: 1.2.5i5
+Date: 1404731026
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index d164279..57df62b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,7 @@
* 0175 logwatch.groups: New logwatch subcheck who can be used to group logfiles
together....
* 1041 aix_memory: new check for RAM and SWAP on AIX
* 0998 ibm_imm_health: Trying to recognice newer versions of IBM IMM now too
+ * 0628 raritan_pdu_inlet: now also monitors the three phases of the inlet
* 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/raritan_pdu_inlet b/checkman/raritan_pdu_inlet
index f615df8..146ff19 100644
--- a/checkman/raritan_pdu_inlet
+++ b/checkman/raritan_pdu_inlet
@@ -14,7 +14,7 @@ description:
The state of the check reflects the state of the device.
item:
- The ID Number of the inlet and the sensor type.
+ The ID Number of the inlet and the sensor type, plus the phase.
perfdata:
Exactly one number: The measured value together with it's unit.
diff --git a/checks/raritan_pdu_inlet b/checks/raritan_pdu_inlet
index bca7b73..2afedd8 100644
--- a/checks/raritan_pdu_inlet
+++ b/checks/raritan_pdu_inlet
@@ -76,47 +76,56 @@ states = {
}
def get_capability(cap_entry, id):
+ id = id - 1
bit = bin(ord(cap_entry))[2:][id]
if bit == "1":
return capabilities[id]
def inventory_raritan_pdu_inlet(info):
inventory = []
+ i = 0
for line in info[1]:
- i = int(line[0].split(".")[2]) -1
+ i += 1
cap = get_capability(info[0][0][2][0],i)
- if line[3] == "1" and cap:
+ if line[2] == "1" and cap:
item = info[0][0][0] + "-" + cap
inventory.append((item, None))
+ item = info[0][0][0] + "-" + cap + "_L1"
+ inventory.append((item, None))
+ item = info[0][0][0] + "-" + cap + "_L2"
+ inventory.append((item, None))
+ item = info[0][0][0] + "-" + cap + "_L3"
+ inventory.append((item, None))
return inventory
-def check_raritan_pdu_inlet(item, params, info):
- state = 3
- message = "Sensor not found"
-
+def check_raritan_pdu_inlet(item, _no_params, info):
+ kinds = { "": 4, "_L1": 5, "_L2": 6, "_L3": 7
}
label = info[0][0][0]
name = info[0][0][1]
+ i = 0
for line in info[1]:
- i = int(line[0].split(".")[2]) - 1
+ i += 1
cap = get_capability(info[0][0][2][0],i)
- if label + "-" + cap == item:
- unit = units[int(line[1])]
- digits = int(line[2])
- avail = line[3]
- status = int(line[4])
- status_txt = states[status]
- value = float(line[5]) / 10.0**digits
- message = "sensor " + name
- message += "status \"%s\", value %.2f %s" %
(status_txt,value,unit)
- perfdata = [ (cap, str(value)+unit) ]
- if avail != "1" or status in ( 2, 6 ):
- state = 2
- elif status == 4:
- state = 0
- else:
- state = 1
+ for mark, index in kinds.iteritems():
+ if cap and label + "-" + cap + mark == item:
+ unit = units[int(line[0])]
+ digits = int(line[1])
+ avail = line[2]
+ status = int(line[3])
+ status_txt = states[status]
+ value = float(line[index]) / 10.0**digits
+ message = "sensor " + name
+ message += "status \"%s\", value %.2f %s" %
(status_txt,value,unit)
+ perfdata = [ (cap+mark, str(value)+unit) ]
+ if avail != "1" or status in ( 2, 6 ):
+ state = 2
+ elif status == 4:
+ state = 0
+ else:
+ state = 1
+ return (state, message, perfdata)
- return (state, message, perfdata)
+ return 3, "no such inlet data"
check_info['raritan_pdu_inlet'] = {
"inventory_function" : inventory_raritan_pdu_inlet,
@@ -133,14 +142,24 @@ check_info['raritan_pdu_inlet'] = {
),
( ".1.3.6.1.4.1.13742.6", # Properties of the sensors
[
- OID_END,
- "3.3.4.1.6", # inletSensorUnits
- "3.3.4.1.7", # inletDecimalDigits
- "5.2.3.1.2", # inlet sensor availability
- "5.2.3.1.3", # inlet sensor state
- "5.2.3.1.4", # inlet sensor value
+ "3.3.4.1.6.1.1", # inletSensorUnits
+ "3.3.4.1.7.1.1", # inletDecimalDigits
+ "5.2.3.1.2.1.1", # inlet sensor availability
+ "5.2.3.1.3.1.1", # inlet sensor state
+ "5.2.3.1.4.1.1", # inlet sensor value
+ "5.2.4.1.4.1.1.1", # inlet sensor L1 value
+ "5.2.4.1.4.1.1.2", # inlet sensor L2 value
+ "5.2.4.1.4.1.1.3", # inlet sensor L3 value
]
- )],
+ ),
+ #( ".1.3.6.1.4.1.13742.6.5.2.4.1.4.1.1", # Properties of the
sensors
+ # [
+ # "1", # inlet sensor values
+ # "2", # inlet sensor values
+ # "3", # inlet sensor values
+ # ]
+ #),
+ ],
"snmp_scan_function" : lambda oid: \
oid(".1.3.6.1.4.1.13742.6.3.2.1.1.3.1").startswith("PX2-2")
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index 5e35c6a..4ff230a 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -1061,21 +1061,21 @@ def perfometer_raritan_pdu_inlet(row, check_command, perf_data):
unit = perf_data[0][2]
display_str = perf_data[0][1] + " " + unit
- if cap == "rmsCurrent":
+ if cap.startswith("rmsCurrent"):
return display_str, perfometer_logarithmic(value, 1, 2, display_color)
- elif cap == "unbalancedCurrent":
+ elif cap.startswith("unbalancedCurrent"):
return display_str, perfometer_linear(value, display_color)
- elif cap == "rmsVoltage":
+ elif cap.startswith("rmsVoltage"):
return display_str, perfometer_logarithmic(value, 500, 2, display_color)
- elif cap == "activePower":
+ elif cap.startswith("activePower"):
return display_str, perfometer_logarithmic(value, 20, 2, display_color)
- elif cap == "apparentPower":
+ elif cap.startswith("apparentPower"):
return display_str, perfometer_logarithmic(value, 20, 2, display_color)
- elif cap == "powerFactor":
+ elif cap.startswith("powerFactor"):
return display_str, perfometer_linear(value * 100, display_color)
- elif cap == "activeEnergy":
+ elif cap.startswith("activeEnergy"):
return display_str, perfometer_logarithmic(value, 100000, 2, display_color)
- elif cap == "apparentEnergy":
+ elif cap.startswith("apparentEnergy"):
return display_str, perfometer_logarithmic(value, 100000, 2, display_color)
return "unimplemented" , perfometer_linear(0, "#ffffff")