[checkmk-commits] Check_MK Git: check_mk: #2019 FIX heartbeat_crm: Be compatible to yet unknown crm_mon output format

Lars Michelsen lm at mathias-kettner.de
Wed Feb 25 16:07:15 CET 2015


Module: check_mk
Branch: master
Commit: af1690fcc19b948100cdbf832c06aa89928a39ed
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=af1690fcc19b948100cdbf832c06aa89928a39ed

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Wed Feb 25 16:07:10 2015 +0100

#2019 FIX heartbeat_crm: Be compatible to yet unknown crm_mon output format

---

 .werks/2019          |   10 ++++++++++
 ChangeLog            |    1 +
 checks/heartbeat_crm |   23 ++++++++++-------------
 3 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/.werks/2019 b/.werks/2019
new file mode 100644
index 0000000..eb4862c
--- /dev/null
+++ b/.werks/2019
@@ -0,0 +1,10 @@
+Title: heartbeat_crm: Be compatible to yet unknown crm_mon output format
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1424876750
+
+
diff --git a/ChangeLog b/ChangeLog
index c61ca69..f3bee00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -195,6 +195,7 @@
     * 1890 FIX: cisco_temperature: Replaces cisco_temp_perf and cisco_temp_sensor...
             NOTE: Please refer to the migration notes!
     * 2018 FIX: ibm_imm_health: Fixed exception when host does provides empty SNMP data
+    * 2019 FIX: heartbeat_crm: Be compatible to yet unknown crm_mon output format
 
     Multisite:
     * 1758 Improved exception hander: Shows details without additional debug request, added mailto link for error report...
diff --git a/checks/heartbeat_crm b/checks/heartbeat_crm
index 4d71bf0..db0b302 100644
--- a/checks/heartbeat_crm
+++ b/checks/heartbeat_crm
@@ -78,9 +78,9 @@ def heartbeat_crm_parse_general(info):
             last_updated = ' '.join(line[2:])
         elif ' '.join(line[0:2]) == 'Current DC:':
             dc = line[2]
-        elif ' '.join(line[1:3])[:-1] == 'Nodes configured':
+        elif ' '.join(line[1:3]).rstrip('.,') == 'Nodes configured':
             num_nodes = int(line[0])
-        elif ' '.join(line[1:3]) == 'Resources configured.':
+        elif ' '.join(line[1:3]).rstrip('.,') == 'Resources configured':
             num_resources = int(line[0])
     return (last_updated, dc, num_nodes, num_resources)
 
@@ -97,17 +97,14 @@ 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)
-    try:
-        last_updated, dc, num_nodes, num_resources = heartbeat_crm_parse_general(info)
-        params = {
-            'num_nodes'     : num_nodes,
-            'num_resources' : num_resources,
-        }
-        if settings.get('naildown_dc', False):
-            params['dc'] = dc
-        return [(None, params)]
-    except:
-        return # No useful information found
+    last_updated, dc, num_nodes, num_resources = heartbeat_crm_parse_general(info)
+    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:



More information about the checkmk-commits mailing list