Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 218
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 219
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 220
#!/bin/bash
# Icinga Plugin to alert Nodewatch alerts.
# Author : Priya Agni
ALERT=$(find /var/log/nodewatch -cmin -60 -name alert)
LAST_ALERT=$(cat /var/log/nodewatch_lastalert)
if [ -z "$ALERT" ]
then
echo "All Containers OK"
>/var/log/nodewatch_lastalert
exit 0
elif [ -z "$(echo $ALERT |grep $LAST_ALERT)" ]
then
echo "WARNING : `cat $ALERT` "
echo $ALERT |awk -F/ '{print $(NF-1)}' > /var/log/nodewatch_lastalert
exit 1
else
{
ALERT=$(echo $ALERT |sed -n -e "s/^.*$LAST_ALERT\/alert//p")
if [ -z "$ALERT" ]
then
echo "All Containers OK"
exit 0
else
echo "WARNING : `cat $ALERT` "
echo $ALERT |awk -F/ '{print $(NF-1)}' > /var/log/nodewatch_lastalert
exit 1
fi
}
fi