mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-12-23 09:33:56 +01:00
Rework hostname detection to use local
Removed socket.gethostname to discover own hostname instead using the local flag which is output from /usr/sbin/clustat -fx node definitions. The gethostname does not always match the cluster node name which would make the check fail.
This commit is contained in:
parent
d11d29185a
commit
55daf8f4c9
@ -72,12 +72,11 @@ def getLocalNodeState(dom):
|
||||
"""
|
||||
Get the state of the local node
|
||||
"""
|
||||
hostname = socket.gethostname()
|
||||
nodesList = dom.getElementsByTagName('node')
|
||||
nodeState = {}
|
||||
|
||||
for node in nodesList:
|
||||
if node.attributes['name'].value == hostname:
|
||||
if node.attributes['local'].value == "1":
|
||||
nodeState['name'] = node.attributes['name'].value
|
||||
nodeState['state'] = node.attributes['state'].value
|
||||
nodeState['rgmanager'] = node.attributes['rgmanager'].value
|
||||
@ -95,7 +94,6 @@ def getServiceState(dom, service):
|
||||
Get the state of the named service
|
||||
"""
|
||||
groupList = dom.getElementsByTagName('group')
|
||||
hostname = socket.gethostname()
|
||||
serviceState = {}
|
||||
for group in groupList:
|
||||
if group.attributes['name'].value in (service,"service:"+service,"vm:"+service):
|
||||
|
Loading…
Reference in New Issue
Block a user