Solved

Configuring Nagios to send mail to an sms gateway

Posted on 2013-05-15
4
637 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Report: Liquid Web beats Amazon, Rackspace & More

A study by performance analyst firm Cloud Spectator finds that Liquid Web beats rivals Amazon, Rackspace and DigitalOcean when it comes to website and cloud application performance.

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
This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

734 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