Module: check_mk
Branch: master
Commit: ee2b13cd9614ad3c413f9799a8d9d311f796590e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ee2b13cd9614ad…
Author: Stefan Botter <jsj(a)jsj.dyndns.org>
Date: Tue Sep 25 11:29:53 2012 +0200
- Modify heartbeat_crm check to check pacemaker/corosync only clusters
Signed-off-by: Stefan Botter <jsj(a)jsj.dyndns.org>
---
checks/heartbeat_crm | 27 ++++++++++++++++++++++++---
1 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/checks/heartbeat_crm b/checks/heartbeat_crm
index f7c9c1b..00573ac 100644
--- a/checks/heartbeat_crm
+++ b/checks/heartbeat_crm
@@ -136,6 +136,7 @@ def heartbeat_crm_parse_resources(info):
blockStart = False
resources = {}
resource = ''
+ mode = 'single'
for line in info:
if not blockStart and ' '.join(line) == 'Full list of
resources:':
blockStart = True
@@ -144,9 +145,29 @@ def heartbeat_crm_parse_resources(info):
# Resource group
resources[line[-1]] = []
resource = line[-1]
+ mode = 'resourcegroup'
+ elif ' '.join(line[0:2]) == 'Clone Set:':
+ # Clone set
+ resources[line[-2]] = []
+ resource = line[-2]
+ mode = 'cloneset'
+ elif ' '.join(line[0:2]) == 'Master/Slave Set:':
+ # Master/Slave set
+ resources[line[-2]] = []
+ resource = line[-2]
+ mode = 'masterslaveset'
elif line[0] == '_':
- # Resource group member
- resources[resource].append(line[1:])
+ # Resource group or set member
+ if mode == 'resourcegroup':
+ resources[resource].append(line[1:])
+ elif mode == 'cloneset':
+ if line[1] == 'Started:':
+ resources[resource].append([ resource, 'Clone',
'Started', line[3] ])
+ elif mode == 'masterslaveset':
+ if line[1] == 'Masters:':
+ resources[resource].append([ resource, 'Master',
'Started', line[3] ])
+ if line[1] == 'Slaves:':
+ resources[resource].append([ resource, 'Slave',
'Started', line[3] ])
else:
# Single resource
resources[line[0]] = [ line ]
@@ -181,7 +202,7 @@ def check_heartbeat_crm_resources(item, target_node, info):
if len(resource) == 3 or resource[2] != 'Started':
status = 2
output += ' (CRITICAL: Resource is in state "%s")' %
resource[2]
- elif target_node and target_node != resource[3]:
+ elif target_node and target_node != resource[3] and resource[1] !=
'Slave' and resource[1] != 'Clone':
status = 2
output += ' (CRITICAL: Expected node: %s)' % target_node
output += ', '