Solved

Configuring Nagios to send mail to an sms gateway

Posted on 2013-05-15
4
641 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

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.
During and after that shift to cloud, one area that still poses a struggle for many organizations is what to do with their department file shares.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 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