Module: check_mk
Branch: master
Commit: 35d97f2eb1810847718c8aff0baec9dd27d3a18b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=35d97f2eb18108…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Jan 11 15:09:21 2017 +0100
4288 FIX sentry_pdu: fixed data handling if power value is missing
Change-Id: Id52e7654af746e8d32f6725b795863c7812292e5
---
.werks/4288 | 10 ++++++++++
ChangeLog | 1 +
checks/sentry_pdu | 18 +++++++++---------
3 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/.werks/4288 b/.werks/4288
new file mode 100644
index 0000000..8466115
--- /dev/null
+++ b/.werks/4288
@@ -0,0 +1,10 @@
+Title: sentry_pdu: fixed data handling if power value is missing
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i4
+Date: 1484143730
+
+
diff --git a/ChangeLog b/ChangeLog
index e356add..73347dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,7 @@
* 4266 FIX: quantum_libsmall_status: fixed scan function
* 4287 FIX: job: fixed incomplete data handling...
* 4268 FIX: cisco_vpn_tunnel: Reporting zero traffic in case the tunnel is down...
+ * 4288 FIX: sentry_pdu: fixed data handling if power value is missing
Multisite:
* 4169 View action: Default values of sticky, notification and persistent options can
now be configured via global settings....
diff --git a/checks/sentry_pdu b/checks/sentry_pdu
index 7a76902..47b7530 100644
--- a/checks/sentry_pdu
+++ b/checks/sentry_pdu
@@ -29,6 +29,7 @@ def inventory_sentry_pdu(info):
for line in info:
yield line[0], int(line[1])
+
def check_sentry_pdu(item, params, info):
states = {
0: "off",
@@ -39,7 +40,8 @@ def check_sentry_pdu(item, params, info):
5: "onError",
6: "noComm",
}
- for name, state, power in info:
+
+ for name, state, power_str in info:
if item == name:
required_state = params
# The Wato rule returns eighter on or off
@@ -48,20 +50,18 @@ def check_sentry_pdu(item, params, info):
elif required_state == 'off':
required_state = 0
state = int(state)
- power = int(power)
- infotext = "State is %s" % states[state]
+ infotext = "Status: %s" % states[state]
if state != required_state:
yield 2, infotext
else:
yield 0, infotext
- infotext = "Current consumption %s Watt" % power
- perfdata = [ ('power', power )]
- yield 0, infotext, perfdata
- return
+ if power_str:
+ power = int(power_str)
+ infotext = "Power: %s Watt" % power
+ perfdata = [ ('power', power )]
+ yield 0, infotext, perfdata
- yield 3, 'Phase information not found'
- return
check_info["sentry_pdu"] = {
"check_function" : check_sentry_pdu,