Easy Guardian sending SMS from Nagios

Think how nice will be to receive SMS notification from NAGIOS for your monitored services, in this tutorial we will see how to send notifications via SMS.
NAGIOS SMS ALERT NOTIFICATION
Using SEasy Guardian EMAIL to SMS gateway function it is really simple, just setup NAGIOS to send out email notifications and then setup
Easy Guardian gateway to forward email to sms followinf this guide:
http://www.smsfoxbox.it/the_news/latest_news/how_to_join__sms_to_your_server_environment.html


Here there are some sample files to tune up procmail configuration so that the system will divert each message to the
designed mobile phone number.

To divert all email messages make sure that the .procmailrc script located inside /etc/ folder looks like this

SHELL=/bin/sh VERBOSE=OFF
MAILDIR=/mnt/flash/root/procmail
DEFAULT=/mnt/flash/spool/mail/mails
LOGFILE=/mnt/flash/spool/mail/procmail.log
#OUTFILE="/mnt/flash/spool/smsgw.out.XXXXXX"
OUTFILE=$(/bin/mktemp /mnt/flash/spool/outgoing/smsgw.out.XXXXXX)

:0
* ^Subject:.*
{
:0 b
| grep -v ^$ | sed '/To:/G' | /etc/sms/scripts/email2sms
}
Here you can download the script email2sms that you have to put in /etc/sms/scripts/.
Replace in the script the XXXXXXXXXX with the designed mobile number and if you want uncomment blocks to
add more destinations.
#!/bin/sh 
#SCRIPT: MAIL2SMS
#AUTHOR: Davide Cantaluppi
\n This e-mail address is being protected from spam bots, you need JavaScript enabled to view it This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
#DATE: 28.02.06
#REV: 1.1a
#PLATFORM: Not platform dependent
PURPOSE: This is a "parser" for the message passed from procmail
# print the whole email body as the output to OUTFILE

cat > /var/temp.txt OUTFILE=$(mktemp /mnt/flash/spool/outgoing/smsgw.out.X)
echo "From: Nagios" > $OUTFILE
echo "To: XXXXXXXXXXX" >> $OUTFILE
echo "" >> $OUTFILE
cat >>$OUTFILE
#NAGIOS SECOND NOTIFICATION
#OUTFILE=$(mktemp /mnt/flash/spool/outgoing/smsgw.out.XXXXXX)
#echo "From: Nagios" > $OUTFILE
#echo "To: 39XXXXXXXX" >> $OUTFILE
#echo "" >> $OUTFILE
#cat /var/temp.txt >>$OUTFILE