Module: check_mk
Branch: master
Commit: 8165f582548505c3eebef32aa180d521e951667d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8165f582548505…
Author: Ronny Bruska <rb(a)mathias-kettner.de>
Date: Wed Mar 13 09:28:05 2019 +0100
7199 FIX heartbeat_crm: Fixed discovery of services in case of failed actions
Because of changes in pacemaker in some cases wrong services named "Heartbeat CRM
Failed"
where discovered if there are open failed actions.
This has been fixed.
If you already have discovered such services, you need to re-discover the services of the
affected hosts.
Change-Id: Iab3534bf38eb685935d57b5ec9b4b17f209d7950
---
.werks/7199 | 15 +++
checks/heartbeat_crm | 2 +-
.../checks/generictests/datasets/heartbeat_crm.py | 145 +++++++++++++++++++++
3 files changed, 161 insertions(+), 1 deletion(-)
diff --git a/.werks/7199 b/.werks/7199
new file mode 100644
index 0000000..d6acc9f
--- /dev/null
+++ b/.werks/7199
@@ -0,0 +1,15 @@
+Title: heartbeat_crm: Fixed discovery of services in case of failed actions
+Level: 1
+Component: checks
+Compatible: incomp
+Edition: cre
+Version: 1.6.0i1
+Date: 1552465401
+Class: fix
+
+Because of changes in pacemaker in some cases wrong services named "Heartbeat CRM
Failed"
+where discovered if there are open failed actions.
+This has been fixed.
+
+If you already have discovered such services, you need to re-discover the services of
the
+affected hosts.
diff --git a/checks/heartbeat_crm b/checks/heartbeat_crm
index 81681da..5372cae 100644
--- a/checks/heartbeat_crm
+++ b/checks/heartbeat_crm
@@ -221,7 +221,7 @@ def heartbeat_crm_parse_resources(info):
for parts in info:
line = " ".join(parts)
- if line.lower() == 'failed actions:':
+ if "failed" in line.lower() and "actions" in line.lower():
blockStart = False
elif not blockStart and line == 'Full list of resources:':
blockStart = True
diff --git a/tests/unit/checks/generictests/datasets/heartbeat_crm.py
b/tests/unit/checks/generictests/datasets/heartbeat_crm.py
new file mode 100644
index 0000000..e965a62
--- /dev/null
+++ b/tests/unit/checks/generictests/datasets/heartbeat_crm.py
@@ -0,0 +1,145 @@
+# yapf: disable
+
+
+checkname = 'heartbeat_crm'
+
+
+info = [[u'Stack:', u'corosync'],
+ [u'Current',
+ u'DC:',
+ u'hrssc61i02',
+ u'(version',
+ u'1.1.19+20180928.0d2680780-1.8-1.1.19+20180928.0d2680780)',
+ u'-',
+ u'partition',
+ u'with',
+ u'quorum'],
+ [u'Last', u'updated:', u'Mon', u'Mar',
u'11', u'14:17:33', u'2019'],
+ [u'Last',
+ u'change:',
+ u'Thu',
+ u'Feb',
+ u'28',
+ u'17:40:07',
+ u'2019',
+ u'by',
+ u'hacluster',
+ u'via',
+ u'cibadmin',
+ u'on',
+ u'hrssc61i01'],
+ [u'2', u'nodes', u'configured'],
+ [u'10', u'resources', u'configured'],
+ [u'Online:', u'[', u'hrssc61i01', u'hrssc61i02',
u']'],
+ [u'Full', u'list', u'of', u'resources:'],
+ [u'Resource', u'Group:', u'grp_IFG_ASCS22'],
+ [u'_',
+ u'rsc_ip_IFG_ASCS22',
+ u'(ocf::heartbeat:IPaddr2):',
+ u'Started',
+ u'hrssc61i01'],
+ [u'_',
+ u'rsc_sap_IFG_ASCS22',
+ u'(ocf::heartbeat:SAPInstance):',
+ u'Started',
+ u'hrssc61i01'],
+ [u'Resource', u'Group:', u'grp_IFG_ERS23'],
+ [u'_',
+ u'rsc_ip_IFG_ERS23',
+ u'(ocf::heartbeat:IPaddr2):',
+ u'Started',
+ u'hrssc61i02'],
+ [u'_',
+ u'rsc_sap_IFG_ERS23',
+ u'(ocf::heartbeat:SAPInstance):',
+ u'Started',
+ u'hrssc61i02'],
+ [u'Clone', u'Set:', u'clone_nfs_sapmnt_IFG',
u'[nfs_sapmnt_IFG]'],
+ [u'_', u'Started:', u'[', u'hrssc61i01',
u'hrssc61i02', u']'],
+ [u'Clone', u'Set:', u'clone_nfs_usr_sap_IFG',
u'[nfs_usr_sap_IFG]'],
+ [u'_', u'Started:', u'[', u'hrssc61i01',
u'hrssc61i02', u']'],
+ [u'st-vmware', u'(stonith:fence_vmware_rest):',
u'Started', u'hrssc61i02'],
+ [u'st-vmware2', u'(stonith:fence_vmware_rest):',
u'Started', u'hrssc61i01'],
+ [u'Failed', u'Resource', u'Actions:'],
+ [u'*',
+ u'st-vmware_monitor_20000',
+ u'on',
+ u'hrssc61i02',
+ u"'unknown",
+ u"error'",
+ u'(1):',
+ u'call=43,',
+ u'status=Error,',
+ u"exitreason='',"],
+ [u'_',
+ u"last-rc-change='Mon",
+ u'Mar',
+ u'4',
+ u'09:29:54',
+ u"2019',",
+ u'queued=0ms,',
+ u'exec=11096ms'],
+ [u'*',
+ u'st-vmware2_monitor_20000',
+ u'on',
+ u'hrssc61i01',
+ u"'unknown",
+ u"error'",
+ u'(1):',
+ u'call=43,',
+ u'status=Error,',
+ u"exitreason='',"],
+ [u'_',
+ u"last-rc-change='Mon",
+ u'Mar',
+ u'4',
+ u'09:29:54',
+ u"2019',",
+ u'queued=0ms,',
+ u'exec=11088ms']]
+
+
+discovery = {'': [(None, {'num_nodes': 2, 'num_resources':
10})],
+ 'resources': [(u'clone_nfs_sapmnt_IFG', None),
+ (u'clone_nfs_usr_sap_IFG', None),
+ (u'grp_IFG_ASCS22', None),
+ (u'grp_IFG_ERS23', None),
+ (u'st-vmware', None),
+ (u'st-vmware2', None)]}
+
+
+checks = {
+ #TODO the main check uses the current time which can currently not be patched
in generic tests
+ #'': [(None,
+ # {'max_age': 60, 'num_nodes': 2, 'num_resources':
10},
+ # [(3, 'Ignoring reported data (Status output too old: 42 h)',
[])])],
+ 'resources': [(u'clone_nfs_sapmnt_IFG',
+ {},
+ [(0,
+ u"clone_nfs_sapmnt_IFG Clone Started
[u'hrssc61i01', u'hrssc61i02']",
+ [])]),
+ (u'clone_nfs_usr_sap_IFG',
+ {},
+ [(0,
+ u"clone_nfs_usr_sap_IFG Clone Started
[u'hrssc61i01', u'hrssc61i02']",
+ [])]),
+ (u'grp_IFG_ASCS22',
+ {},
+ [(0,
+ u'rsc_ip_IFG_ASCS22 (ocf::heartbeat:IPaddr2): Started
hrssc61i01, rsc_sap_IFG_ASCS22 (ocf::heartbeat:SAPInstance): Started hrssc61i01',
+ [])]),
+ (u'grp_IFG_ERS23',
+ {},
+ [(0,
+ u'rsc_ip_IFG_ERS23 (ocf::heartbeat:IPaddr2): Started
hrssc61i02, rsc_sap_IFG_ERS23 (ocf::heartbeat:SAPInstance): Started hrssc61i02',
+ [])]),
+ (u'st-vmware',
+ {},
+ [(0,
+ u'st-vmware (stonith:fence_vmware_rest): Started
hrssc61i02',
+ [])]),
+ (u'st-vmware2',
+ {},
+ [(0,
+ u'st-vmware2 (stonith:fence_vmware_rest): Started
hrssc61i01',
+ [])])]}