Solved

Configuring Nagios to send mail to an sms gateway

Posted on 2013-05-15
4
624 Views
Last Modified: 2013-05-20
Hello,

I'm trying to set up Nagios to send sms notifications. My solution is to use Clickatell and have nagios send a mail notification and then clickatell will send that mail out as an sms.

I've used the standard mail notification command as a template to build the mail to clickatell.

here is what I've got so far:

define command {
    command_name    host_notify_with_sms
    command_line    /usr/bin/printf "%b" "user:MahUsername\n password:MahPass\n              api_id:3424566\n text:*Nagios* Note Type: $NOTIFICATION TYPE$ Service: $SERVICEDESC$ Host: $HOSTALIAS$ IP: $HOSTADDRESS$ Stat    e: $SERVICESTATE$ Date/Time: $LONGDATETIME$\n to:$CONTACTPAGER$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" sms@messaging.clickatell.com
 }

Open in new window


This code works in the terminal and it produces an sms from Clickatell.

Problem is Nagios does not execute the host_notify_with_sms when a host goes down.

define contact{
          contact_name                         Ian
          alias                                        Ian
          service_notification_period     24x7
          host_notification_period         24x7
          service_notification_options    w,u,c,r
          host_notification_options        d,r
          service_notification_commands     notify-service-by-email, host_notify_with_sms
          #service_notification_commands   notify-service-by-email  
          host_notification_commands         notify-host-by-email
          email                                             ian@fake.no
          pager                                            4748943802
  }

Open in new window

0
Comment
Question by:Nisroc66
  • 3
4 Comments
 
LVL 18

Expert Comment

by:Sanga Collins
ID: 39167707
I would create a contact called SMS-contact with the email address: sms@messaging.clickatell.com. And for the hosts and services that you want to send an sms you can just add the SMS-contact as one of the values.
0
 

Author Comment

by:Nisroc66
ID: 39170562
that doesn't really solve my problem in the long run. As I have people that are responsible for different clients and need to get the right notifications. So there will be more than one phone number in use.

But for now I just want Nagios to send an e-mail to clickatell. it send normal e-mail notifications just fine but when a host or service goes down it doesn't proc host_notify_with_sms
0
 

Accepted Solution

by:
Nisroc66 earned 0 total points
ID: 39170682
nvm. I found the problem. Must have been a bit knackered yesterday.
0
 

Author Closing Comment

by:Nisroc66
ID: 39180483
My Bad
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to set-up an On Demand, IPSec, Site to SIte, VPN from a Draytek Vigor Router to a Cyberoam UTM Appliance. A concise guide to the settings required on both devices
Most of the applications these days are on Cloud. Cloud is ubiquitous with many service providers in the market. Since it has many benefits such as cost reduction, software updates, remote access, disaster recovery and much more.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question