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

  • Hi,

    Great post. Works for me. But how to send notifications to many mobiles? says comma separated but dont work for me. I’m using pager field instead of email. and HTTP API.

  • Karthik

    Hi , thansk for the wonderful post, Can some ne please let me know how to setup a local nagios server with a gsm modem connected on it for sending sms alerts.

    I understand that its an old method but any help help would be much appreciated.

  • Pingback: Required help in configuration of sms alert in Nagios()

  • Hi,

    Just wanted to point out to a new service that you can use to send Nagios alerts to iPhone/iPad and Android devices using push notifications in addition to sending alerts via email and SMS.

    OpsGenie is a web based service that offers multiple notification methods. OpsGenie ( is offered as a FREE service up to 2 users. How to configure Nagios is described here

    Karthik you can find a detailed explanation of how you can use a gsm model to send alerts via SMS here:

  • daniel77

    A major nuisance with 3rd party sms providers (like Clickatel) is that when your internet connection fails (or any device between your nagios server and edge-router) then your sms alerts will not be sent…

    If you want to avoid such problems, I’d suggest to think about investing into a hardware gsm gateway. This is a device which you buy, connect in your LAN, put a SIM card inside and have a sms gateway for your own. This way you are secure with sending alerts even if your internet connection fails. Those kind of devices can usually offer you out-of the box solution for nagios sms alerts.

    An example of such hardware sms gateway would be SMSEagle
    They have ready to use nagios sms plugin here

    This approach needs one-time investment, but is worth looking at.

  • i am unable to get the sms

    wget “ 923214212379&text=’ *** Welcome to ***'”

  • Ranjith

    I think the best way is to try it using It will basically send out SMS text message to you and your team as soon as you receive email from your nagios system. It works well for me. Its super fast. Try it.