schmuck
Nimbostratus
Apr 06, 2016Notifications via External Monitor
Hi, I have an external monitor that sends a notification (email) when it fails. I don't want it failing so I just had it create a file when if fails. If that file doesn't exist, it will notify. If it does exist, it just marks it down but doesn't send the alert. The way I thought to clean it up was just to rm-f the file when the status goes back to UP. This works fine if the script is run manually, but will not work when it runs through F5. Here are the basics of the script:
curl -s -v -k -H "Host: ${HOST}" -k https://${NODE}${URI} 2>&1 > /dev/null | grep -i "${RECV}"
STATUS=$?
rm -f $PIDFILE
if [ $STATUS -eq 0 ]
then
rm -f /shared/tmp/service-${NODE}
echo "UP"
else
if [ ! -f /shared/tmp/service-${NODE} ]
then
touch /shared/tmp/service-${NODE}
chmod 777 /shared/tmp/service-${NODE}
curl -s -o /shared/tmp/service-${NODE}.html -H "Host: ${HOST}" -k https://${NODE}${URI}
EMAIL NOTIFICATION PART
fi
fi
exit
Is there something that I am missing? Is there a better way?