Module: check_mk
Branch: master
Commit: 16c2e36463629ef152b61bdab686f67fbf56c744
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=16c2e36463629e…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Jul 28 09:33:58 2015 +0200
fixed merge conflict
---
.werks/1274 | 10 ++++++++++
ChangeLog | 1 +
checks/heartbeat_crm | 23 ++++++++++++++---------
3 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/.werks/1274 b/.werks/1274
new file mode 100644
index 0000000..3321592
--- /dev/null
+++ b/.werks/1274
@@ -0,0 +1,10 @@
+Title: heartbeat_crm: Handle case of error messages from CRM
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i3
+Date: 1438068579
+
+
diff --git a/ChangeLog b/ChangeLog
index 29c311d..ae5df7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -77,6 +77,7 @@
* 2473 FIX: cisco_asa_failover: Reworked check to reflect expected primary/secondary
states of devices...
* 2476 FIX: check_bi_aggr: Fixed exception when authentication is enabled
* 2477 FIX: SNMP: Fixed exception when processing specific SNMP data with missing
columns...
+ * 1274 FIX: heartbeat_crm: Handle case of error messages from CRM
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce
unhandled exceptions...
diff --git a/checks/heartbeat_crm b/checks/heartbeat_crm
index 9fbc7ff..c567a59 100644
--- a/checks/heartbeat_crm
+++ b/checks/heartbeat_crm
@@ -100,18 +100,23 @@ def inventory_heartbeat_crm(info):
# - Check the number of nodes/resources
# - Check the age of "last updated"
settings = host_extra_conf_merged(g_hostname, inventory_heartbeat_crm_rules)
- last_updated, dc, num_nodes, num_resources = heartbeat_crm_parse_general(info)
- if last_updated:
- params = {
- 'num_nodes' : num_nodes,
- 'num_resources' : num_resources,
- }
- if settings.get('naildown_dc', False):
- params['dc'] = dc
- return [(None, params)]
+ try:
+ last_updated, dc, num_nodes, num_resources = heartbeat_crm_parse_general(info)
+ except:
+ # In the case that CRM is not working, add it as a service and show the error
later
+ last_updated, dc, num_nodes, num_resources = 0,0,0,0
+ params = {
+ 'num_nodes' : num_nodes,
+ 'num_resources' : num_resources,
+ }
+ if settings.get('naildown_dc', False):
+ params['dc'] = dc
+ return [(None, params)]
def check_heartbeat_crm(item, params, info):
if len(info) > 0:
+ if info[0][0].lower().startswith("critical"):
+ return 2, " ".join(info[0])
last_updated, dc, numNodes, numResources = heartbeat_crm_parse_general(info)
# Convert old tuple params (pre 1.2.5i6)