Send SMS in Linux

Stefano Coletta creator at mindcreations.com
Thu Nov 24 17:17:32 CET 2005


Use the SMS Server Tools
http://smstools.meinemullemaus.de/

Add this to the misccommands.cfg

define command {
command_name                   notify-by-sms
command_line                   /bin/echo "/usr/local/bin/sendnagiossms
$CONTACTPAGER$ \"$NOTIFICATIONTYPE$: Service $SERVICEDESC$ on
$HOSTALIAS$ is $SERVICESTATE$ ($OUTPUT$) - °$DATETIME$\"" | ssh yourhost
}

Replace yourhost with your SMS host where you have to install SMS Server
tools.
Note: $CONTACTPAGER has to include country prefix number.

Establish an ssh key trust between nagios user on the nagios host and
the relative user on the sms server so it will not ask for a password.

Then add the command /usr/local/bin/sendnagiossms on the SMS server:

#!/bin/sh
OLD_MSG_NODATE=`echo $2 | cut -d° -f 1`
OLD_DATE=`echo $2 | cut -d° -f 2`
NEW_DATE=`date -d "$OLD_DATE" +"%e-%b %H:%M"`

TEXT="$OLD_MSG_NODATE$NEW_DATE"
STRIPPED_TEXT=`echo $TEXT | sed -f /usr/local/bin/sendnagiossms.sed`

/usr/local/bin/sendsms $1 "$STRIPPED_TEXT"

and the file for sed /usr/local/bin/sendnagiossms.sed

s/000000/0/g
s/00000/0/g
s/°//g

Once you have tested that SMS Server tools is properly installed try
configuring Nagios to send sms using this command instead of notify-by-email

Enjoy

Marco Borsani wrote:

>I all !
>
>I should configure Nagios (on a RedHat Ent 3.0) to send SMS, using a
>radiomoden connected on a serial port.
>
>May someone give me an help ?
>
>I suppose that a script/programm is necessary to this porpuse, is it true?
>
>How do you send SMS from Nagios?
>
>Thanks a lot.
>
>Marco 
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>for problems?  Stop!  Download the new AJAX search engine that makes
>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
>_______________________________________________
>Nagios-users mailing list
>Nagios-users at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/nagios-users
>::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
>::: Messages without supporting info will risk being sent to /dev/null
>  
>


-- 
Stefano Coletta

http://www.mindcreations.com



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list