first commit
This commit is contained in:
25
scripts/gluster_checks/check_gluster_heal.sh
Normal file
25
scripts/gluster_checks/check_gluster_heal.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
#Roy Cohen :roy@wondercohen.nl
|
||||
#objective :Gluster check heal for Nagios
|
||||
#First line of code :15/01/2019
|
||||
#last update :23/01/2019
|
||||
#version :1.0
|
||||
|
||||
######START OF SCRIPT#######
|
||||
OUT=$(cat /tmp/gluster_monitoring_heal 2>/dev/null |grep -a -v volume |sed "s/^[ \t]*//"| grep -a -v ^0 > /dev/null 2>&1 )
|
||||
EXIT_CODE=$?
|
||||
if [ -f /tmp/gluster_monitoring_heal ]; then
|
||||
if [[ $(find /tmp -name "gluster_monitoring_heal" -mmin +4 -print) ]]; then
|
||||
echo "WARNING: there was an error during the gluster heal check. please check the output of /root/scripts/check_gluster.sh or the nrpe status"
|
||||
exit 1
|
||||
elif [ "$EXIT_CODE" -eq 0 ]; then
|
||||
echo -e "WARNING: volumes healing at this moment\n$(cat /tmp/gluster_monitoring_heal |sed "s/^[ \t]*//" | grep -a -v ^0)" && rm -f /tmp/gluster_monitoring_heal
|
||||
exit 1
|
||||
else
|
||||
echo "OK: no volumes healing at this moment" && rm -f /tmp/gluster_monitoring_heal
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo "WARNING: there was an error during the gluster heal check please check /tmp/gluster_monitoring_heal"
|
||||
exit 1
|
||||
fi
|
Reference in New Issue
Block a user