Nagios sms alert configuration

Nagios SMS Alert Configuration

Scenario : Migration of local nagios server to amazon EC2

My current setup was a local nagios server with a gsm modem connected on it for sending sms alerts.

But in the new setup , I need to set up nagios server remotely ( amazon ).  All other parts we did just like the existing server except sms alert configuration.

To setup sms alert , we should use a third party to send sms through their servers.  We signed up with sms gateway service, its cheap and reliable.

Once you start an account with them , they will provide login details with a client id. To use their sms gate way service , we need to create appropriate API

1) Create an API in clicatel gateway service

They are providing lots of methods to send sms through their gateway like https, smtp etc. I selected http and create the http API . Its pretty easy with their panel.

2)  Define New Command in commands.cfg

# host-notify-by-sms command definition
 define command{
 command_name host-notify-by-sms
 command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$ \nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | wget "$CONTACTEMAIL$&text='** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ @ $LONGDATETIME$ **'"

# service-notify-by-sms command definition

define command{
 command_name service-notify-by-sms
 command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$ \nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | wget "$CONTACTEMAIL$&text='** $NOTIFICATIONTYPE$ Service Alert: $SERVICEDESC$ on $HOSTNAME$ State: $SERVICESTATE$ @ $LONGDATETIME$ **'"

3) Use new command in contacts.cfg

define contact{
contact_name                    admin
alias                                  Adminlogs
service_notification_period     24×7
host_notification_period        24×7
service_notification_options    c,r
host_notification_options         d,r
service_notification_commands   service-notify-by-sms
host_notification_commands      host-notify-by-sms
email                           651234567

4) Verify nagios configuaration

nagios -v /etc/nagios/nagios.cfg

5) Restart nagios

6) Test and Verify new command

wget " 651234567&text=' *** Welcome to ***'"

If you are getting the message to your number then log out and we can go for a tea 😀  …Yes , You completed the sms alert configuration successfully ..Nagios Rocks !!!!! 😉

From the Clickatel panel , you will get the complete report about the nagios alerts sent via their gateway