Module: check_mk
Branch: master
Commit: 101803c0996796edc7927de764940ce94b143a09
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=101803c0996796…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Apr 5 15:58:53 2011 +0200
FIX: heartbeat_rscstatus handles empty agent output correctly
---
ChangeLog | 1 +
checks/heartbeat_rscstatus | 9 ++++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b23ebd2..fddfd9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,7 @@
* if/if64: also output performance data if operstate not as expected
* if/if64: scan function now also detects devices where the first port
* if/if64: also show perf-o-meter if speed is unknown
+ * FIX: heartbeat_rscstatus handles empty agent output correctly
1.1.10:
diff --git a/checks/heartbeat_rscstatus b/checks/heartbeat_rscstatus
index 67fe3ee..ec336e4 100644
--- a/checks/heartbeat_rscstatus
+++ b/checks/heartbeat_rscstatus
@@ -36,9 +36,12 @@ def inventory_heartbeat_rscstatus(checktype, info):
return [ (None, '"%s"' % line[0]) for line in info if line[0] !=
'' ]
def check_heartbeat_rscstatus(item, expected_state, info):
- if (type(expected_state) == list and info[0][0] in expected_state) or info[0][0] ==
expected_state:
- return (0, "OK - Current state: %s" % (info[0][0]))
+ if len(info) > 0 and len(info[0]) > 0:
+ if (type(expected_state) == list and info[0][0] in expected_state) or info[0][0]
== expected_state:
+ return (0, "OK - Current state: %s" % (info[0][0]))
+ else:
+ return (2, "CRITICAL - Current state: %s (Expected: %s)" %
(info[0][0], expected_state))
else:
- return (2, "CRITICAL - Current state: %s (Expected: %s)" % (info[0][0],
expected_state))
+ return (3, "UNKNOWN - Got no information from agent")
check_info['heartbeat_rscstatus'] = (check_heartbeat_rscstatus, "Heartbeat
Ressource Status", 0, inventory_heartbeat_rscstatus)