?
Solved

Configuring Nagios to send mail to an sms gateway

Posted on 2013-05-15
4
Medium Priority
?
661 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

A Cyber Security RX to Protect Your Organization

Join us on December 13th for a webinar to learn how medical providers can defend against malware with a cyber security "Rx" that supports a healthy technology adoption plan for every healthcare organization.

Question has a verified solution.

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

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

840 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