SMS Server

Taking care of your Linux box.

Postby eternal peace » Wed Oct 22, 2008 5:23 pm

Nothing special in script i've used only wget to send message through http request, script takes two arguments the message to send and mobile number,

Code: Select all

#!/bin/sh

mesg=$( echo $1 | sed -e 's/ /%20/g' )         //replacing white spaces with %20

wget --spider wget --spider http://corporatesms.mobilinksms.com/css_api.php?mobile_no=$2\&login_name=xxxx\&password=xxxxx\&message="$mesg"



Save the script (sendsms.sh) in your Nagios plugins directory, then in Nagios commands.cfg file add,

Code: Select all

# 'host-notify-by-sms' command definition
define command{
        command_name    host-notify-by-sms
        command_line    $USER1$/sendsms.sh "$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$" $CONTACTPAGER$
        }


and then in Nagios contacts.cfg use the above command with the "host_notification_commands" directive as,

Code: Select all

define contact{
        contact_name                    xxxx
        alias                           xxxx
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    c,r,w
        host_notification_options       d,r
        service_notification_commands   notify-by-email,notify-by-sms
        host_notification_commands      host-notify-by-email,host-notify-by-sms
        email                           xxxx@xxxx.com
        pager                           00923001234567
        }


Note: I've used the pager number as mobile number.
hail to linux!!!
eternal peace
Naik
 
Posts: 86
Joined: Thu Apr 03, 2003 6:44 pm

Return to “%s” Administration

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest