Module: check_mk
Branch: master
Commit: 7fb74461f62db455378ed2e47c85391361ce3194
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7fb74461f62db4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 27 13:21:05 2016 +0100
#2971 FIX heartbeat_crm: Is now compatible with more forms of crm_mon output formats
---
.werks/2971 | 9 +++++++++
ChangeLog | 1 +
checks/heartbeat_crm | 19 ++++++++++++++++---
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/.werks/2971 b/.werks/2971
new file mode 100644
index 0000000..755c9e4
--- /dev/null
+++ b/.werks/2971
@@ -0,0 +1,9 @@
+Title: heartbeat_crm: Is now compatible with more forms of crm_mon output formats
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453897233
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 2dda256..49f7d06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -224,6 +224,7 @@
* 2962 FIX: esx_vsphere_vm.guest_tools: Fixed exception in case no version info is
available
* 2963 FIX: esx_vsphere_datastores: Deal with empty url attribute of datastores
* 2983 FIX: netapp_api_disk: fixed exception when disks were not included in the
raid...
+ * 2971 FIX: heartbeat_crm: Is now compatible with more forms of crm_mon output
formats
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/checks/heartbeat_crm b/checks/heartbeat_crm
index 5070704..d8bde4e 100644
--- a/checks/heartbeat_crm
+++ b/checks/heartbeat_crm
@@ -75,10 +75,23 @@ def heartbeat_crm_parse_general(info):
num_nodes = None
num_resources = None
for line in info:
- if ' '.join(line[0:2]) == 'Last updated:':
- last_updated = ' '.join(line[2:])
- elif ' '.join(line[0:2]) == 'Current DC:':
+ line_txt = ' '.join(line)
+
+ if line_txt.startswith("Last updated:"):
+ if "Last change:" in line_txt:
+ # Some versions seem to combine both lines
+ last_updated = line_txt[:line_txt.index("Last
change:")].split(": ")[1].strip()
+ else:
+ last_updated = ' '.join(line[2:])
+
+ elif line_txt.startswith('Current DC:'):
dc = line[2]
+
+ elif "nodes and" in line_txt and "resources configured" in
line_txt:
+ # Some versions put number of nodes and resources in one line
+ num_nodes = int(line[0])
+ num_resources = int(line[3])
+
elif ' '.join(line[1:3]).rstrip('.,') == 'Nodes
configured':
num_nodes = int(line[0])
elif ' '.join(line[1:3]).rstrip('.,') == 'Resources
configured':