Nagios(FAN) – SMS Alerts via SMSTools

Todays post is actually going to be a guest post of sorts… Bob was Kind enough to write very detailed documentation on how to Setup SMS Alerts in Nagios via SMSTools. And since existing documentation on the process from start to finish is scarce at best – I thought I would share it here. It should be noted however that if you wish to use this method, you will need to have a GSM modem or qualifying mobile Device attached to your Nagios Server.~Enjoy

 

Before We Get Started…

 

Before we Dive in and start setting up SMSTools or Centreon Notifications, There are a number of prerequisites that need to be satisfied first. Bob has tried to make this process as easy as possible to follow – however if you run into any issues along the way, please comment below and we will do our best to get you up and running.
( Bob is pretty much a genius when it comes to Nagios! 😀 )

 

Download & Install CMake for CentOS-5


Install GCC


Install eject


Install comget

 

.

Configuring Your GSM Modem

 

1.)  Insert gsm modem in usb port

2.)  Run


3.)
Check which modem Port it’s connected to


4.)
Eject the Cd-rom sro & sr1 as per your setup


5.)
Connect gsm modem to usb port ( USB0 in my case )


6.)
When the modem is connected you will get a message with your service provider name

7.)  Create symbolic link to /dev/modem

 

TO TEST THAT THE USB MODEM IS ON USB0

 

.

Installing & Configuring SMSTools

 

1.)  Install SMS Tools

-or-

 

2.)  Make Sure you have the Following SMSTOOLS3 SERVER Files and Folders Installed

  • incoming = /var/spool/sms/incoming
  • outgoing = /var/spool/sms/outgoing
  • checked = /var/spool/sms/checked
  • failed = /var/spool/sms/failed
  • sent = /var/spool/sms/sent
  • logfile = /var/log/smsd.log
  • Configuration = /etc/smsd.conf

 

3.)  Make sure that SMSTools has the Right Configuration Setting for your modem in:  /etc/smsd.conf
( GSM Modem is on USB0 in this example)

device = /dev/ttyUSB0

 

HOW TO START or STOP THE SMSTOOLS3 SERVER


To Setup SMS Tools to AutoStart on Server Boot….


To Test your SMSTools Install:

 

 

Centreon Setup for SMS Notifications

 

1.)  First, we need to grant the necessary rights to Nagios:

 

2.)  Next We Need to Create 2 new notification Commands in Centreon:

Host-Notify-by-smstools

/usr/bin/printf “%b” ” hostname : $HOSTNAME$ State: $HOSTSTATE$ Address: $HOSTADDRESS$ Date/Time: $DATE$ ” | smssend $CONTACTPAGER$

Centreon_Host_Notify_SMSTools

Service-Notify-by-smstools

/usr/bin/printf “%b” ” $SERVICEDESC$ State: $SERVICESTATE$ Date/Time: $LONGDATETIME$ ” | smssend $CONTACTPAGER$

Centreon_Service_Notify_SMSTools

 

3.)  Next, add the mobile numbers for those involved under: Configuration > Users > Pager

Centreon_User_Pager_SMSTools

 

 

Additional Resources

Nagios(FAN) – A Beginners Guide

http://smstools3.kekekasvi.com/index.php?p=fa
http://nerazan.blogspot.com/2013/07/how-to-configure-gsm-modem-in-linux.html
http://www.marcoach.nl/nagios-sms-notificaties/http://alexnogard.com/notifications-sms-pour-nagios-centreon/