Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

nagios_csmpp Featured

Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Current Version
1.1
Last Release Date
2009-02-10
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion
E-mail
License
GPL
Hits
65636
The article will help you to connect Nagios with SMS gateway with SMPP standard protocol.

This method is very useful especially for different telecommunication operators who has already access the SMPP and can easy automate the monitoring process.

As you know nagios is very flexible for configuration point of view. So you can tune the nagios and send SMS for very specific cases.
You need to have access to SMPP gateway with corresponding user/password before starting implementation.

1. Copy the script to the folder where usually all nagios-plugins are exits already.

Debian Example:

root@nagios:~ # cd /usr/lib/nagios/plugins/
root@nagios:~ # wget http://www.ghevondyan.net/Download/sendmessage.pl.txt -O sendmessage.pl
root@nagios:~ # chmod 755 sendmessage.pl


Add a pager to your contact info in /etc/nagios3/conf.d/contacts_nagios2.cfg and set up sms notification mode like:


define contact{
contact_name aghevondyan
alias Arsen ghevondyan
service_notification_period 24×7
host_notification_period 24×7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email,notify-service-by-sms
host_notification_commands notify-host-by-email,notify-host-by-sms
email arsen@ghevondyan.net
pager +37455127001
}

You can add somewhere else where you area adding usually the contacts.


Now you have to define a command, which talks to our sms-notification-software,
so add these lines to your /etc/nagios3/commands.cfg

define command {
command_name notify-service-by-sms
command_line $USER1$/sendmessage.pl $CONTACTPAGER$ "Nagios-$NOTIFICATIONTYPE$ : $HOSTALIAS$/$SERVICEDESC$ State: $SERVICESTATE$ Additional Info:$SERVICEOUTPUT$"
}

define command {
command_name notify-host-by-sms
command_line $USER1$/sendmessage.pl $CONTACTPAGER$ "Nagios - $NOTIFICATIONTYPE$ : Host $HOSTALIAS$ is $HOSTSTATE$ ($OUTPUT$)"
}


Now Everything should work perfectly!!!.
I believe that my script will help you...

Thanks
Arsen Ghevondyan
Reviews (2)
Hi Arsen,

Thank you very much for this excellent script.

I suggest to add a switch to send the first part of multi-part messages.

To achieve this, I applied the following changes (admittedly quick and dirty):

1. Declaration area:

$send_multimsg = 0;

2. Near the end:

$multimsg_curpart++;
if ($send_multimsg) {
$msgtext = substr ($mymsg, 0, 120, "");
} else {
$msgtext = "";
}
$ref++;

Cheers,

Thomas
bynoriknic, May 16, 2012
Very useful and necessary script for corporation. When you have a lot of systems to monitor and be in course what happen. Use it and you will not regret:)