Solved

Configuring Nagios to send mail to an sms gateway

Posted on 2013-05-15
4
619 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
Comment Utility
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
Comment Utility
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
Comment Utility
nvm. I found the problem. Must have been a bit knackered yesterday.
0
 

Author Closing Comment

by:Nisroc66
Comment Utility
My Bad
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Transparency shows that a company is the kind of business that it wants people to think it is.
Even if you have implemented a Mobile Device Management solution company wide, it is a good idea to make sure you are taking into account all of the major risks to your electronic protected health information (ePHI).
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now