first commit
This commit is contained in:
23
scripts/gluster_checks/check_gluster_peer.sh
Normal file
23
scripts/gluster_checks/check_gluster_peer.sh
Normal file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
#Roy Cohen :roy@wondercohen.nl
|
||||
#objective :Gluster check peer for Nagios
|
||||
#First line of code :15/01/2019
|
||||
#last update :31/01/2019
|
||||
#version :1.0
|
||||
|
||||
######START OF SCRIPT#######
|
||||
SATE_OF_DOWN_PEER=$(cat /tmp/peer_status | grep -a Disconnected | wc -l)
|
||||
IP_OF_DOWN_PEER=$(cat /tmp/peer_status| grep -a -E "Hostname|Disconnected"| grep -a -B1 Disconnected | grep -a Hostname | cut -d ":" -f2| sed "s/^[ \t]*//")
|
||||
|
||||
if [[ $(find /tmp -name "peer_status" -mmin +4 -print) ]]; then
|
||||
echo "WARNING: there was an error during the gluster peer check. please check the output of /root/scripts/check_gluster.sh or the nrpe status"
|
||||
exit 1
|
||||
# check number of active bricks
|
||||
elif [ "$SATE_OF_DOWN_PEER" -eq 0 ] ; then
|
||||
echo "OK: All bricks on are up"
|
||||
exit 0
|
||||
else
|
||||
echo "CRITICAL: There are one or more peers down on $IP_OF_DOWN_PEER"
|
||||
exit 2
|
||||
|
||||
fi
|
Reference in New Issue
Block a user