mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-11-24 19:33:46 +01:00
Corrected a CRITICAL state returned as 1 (WARNING state from nagios POV)
Added a safeguard when information of the local node aren't found
This commit is contained in:
parent
6726f614ad
commit
ca07c14132
@ -1,6 +1,4 @@
|
|||||||
#!/bin/env python
|
#!/bin/env python
|
||||||
|
|
||||||
#
|
|
||||||
# Gather the cluster state and the current node state
|
# Gather the cluster state and the current node state
|
||||||
#
|
#
|
||||||
# Output example:
|
# Output example:
|
||||||
@ -133,7 +131,7 @@ def main():
|
|||||||
if typeCheck == 'cluster':
|
if typeCheck == 'cluster':
|
||||||
|
|
||||||
# First we query for the state of the cluster itself.
|
# First we query for the state of the cluster itself.
|
||||||
# Should it be found tha the cluste ris not quorate we alert and exit immediately
|
# Should it be found that the cluster is not quorate we alert and exit immediately
|
||||||
cluster = getClusterName(dom)
|
cluster = getClusterName(dom)
|
||||||
qState = getQuorumState(dom)
|
qState = getQuorumState(dom)
|
||||||
|
|
||||||
@ -145,15 +143,18 @@ def main():
|
|||||||
# Now we find the status of the local node from clustat.
|
# Now we find the status of the local node from clustat.
|
||||||
# We only care about the local state since this way we can tie the alert to the host.
|
# We only care about the local state since this way we can tie the alert to the host.
|
||||||
nodeStates = getLocalNodeState(dom)
|
nodeStates = getLocalNodeState(dom)
|
||||||
if nodeStates['state'] != "1":
|
if nodeStates == {}:
|
||||||
print "WARNING: Local node state is offline!"
|
print "UNKNOWN: Local node informations couldn't be found!"
|
||||||
sys.exit(1)
|
sys.exit(3)
|
||||||
elif nodeStates['rgmanager'] != "1":
|
if nodeStates['state'] != "1":
|
||||||
print "CRITICAL: RGManager service not running on " + nodeStates['name'] + "!"
|
print "WARNING: Local node state is offline!"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
elif nodeStates['rgmanager'] != "1":
|
||||||
print "OK: Cluster node " + nodeStates['name'] + " is online and cluster is quorate."
|
print "CRITICAL: RGManager service not running on " + nodeStates['name'] + "!"
|
||||||
sys.exit(0)
|
sys.exit(2)
|
||||||
|
else:
|
||||||
|
print "OK: Cluster node " + nodeStates['name'] + " is online and cluster is quorate."
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
elif typeCheck == 'service':
|
elif typeCheck == 'service':
|
||||||
serviceState = getServiceState(dom, serviceName)
|
serviceState = getServiceState(dom, serviceName)
|
Loading…
Reference in New Issue
Block a user