SMS integration with Nagios

SMS integration with Nagios or Nagios alerts on Mobile, Nagios integration with SMS gateway. how to integrate nagios with SMS,nagios SMS integration steps

SMS gateway integration with Nagios.  It is basic need of infrastructure monitoring system to automate notification on mobile for critical service and hosts status. Receiving alerts on mobile using SMS gateway service provider or SMS gateway software tool. You need to find SMS service provider in your region and make sure to verify that they support SMS API in order to integrate with Nagios.

There are several SMS service provider across the globe, pricing of SMS depends.

In India due to DOT rules promotional bulk SMS is prohibited,   you have an option called “transactional SMS” this category is suitable for Banks, schools; organization required to send notification to employees on mobile & sending alerts using website or any business activities. In transactional SMS you have to use predefine templates with static and dynamic contents, planned to send as SMS notification to end user or required stake holders.

To check Nagios SMS integration, you can use demo SMS gateway account from any of the vendor providing SMS service with API support.

SMS service providers.

Vendors:

1. mVaayoo(http://www.mvaayoo.com/)

2. www.smscountry.com

 

We are using mvaayoo account in our example:

Login to your  demo / paid account to collect your SMS API,  by default your SMS API URL looks like this.

http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=test@demoaccount.com:password&senderID=providedbyvendor&receipientno=982832232&dcs=0&msgtxt=This is Test message&state=4

Parameters:

User: Username: password
Senderid: Sender of the User
Recepientno: Mobile numbers- Comma separated
Msgtxt: Message
State: This specifies the response type’s state description
State=0 – User can add a custom message of his/her choice, e.g. “Thanks for submitting your response”.State=1 – User can send sms to multiple numbers (239239291, 34343443,…), unique transaction id are generated for each mobile number on successful submission.State=2 – On sending messages to multiple numbers, this will return a unique Job ID for the campaign.State=3 – On sending messages to multiple numbers, this will return a unique Job ID for the campaign along with multiple Transaction idState=4 – User can send messages to a single mobile number; on successful submission a unique Transaction id is generated.

 

Testing Nagios alerts integration with SMS API

URL:http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=demo@xyz.com  :password&senderID=XYZ&receipientno=920202020&dcs=0&msgtxt=This  is Test message&state=4   

 

Fallowing configuration settings needed in Nagios

Step 1

Edit command.cfg file as indicated below. And modify fallowing settings to test SMS notification alert on mobile.

 

We are adding user1 , user2 in below example and mapping corresponding mobile numbers , there are two type of entries has to be added ,( host alert & other service alert.)

 

[root@monitoring ~]# vi /usr/local/nagios/etc/objects/commands.cfg

#entries for user1

#Host outage notification entries section

#  'notify-host-by-sms' command definition for solutionsatexperts-and-appsupport
   define  command{
           command_name    notify-host-by-user1
           command_line    /usr/bin/printf "%b" "*****  Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:  $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:  $LONGDATETIME$\n" | wget "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=xyz@demosmsaccount.com:password&senderID=XYZ&receipientno=992992922&dcs=0&msgtxt=**  Type : $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ at:  $LONGDATETIME$ **"
     }

 

#Service outage notification entries section

#  'notify-service-by-sms' command definition for solutionsatexperts-and-appsupport
   define  command{
           command_name    notify-service-by-user1
           command_line    /usr/bin/printf "%b" "*****  Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:  $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:  $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional  Info:\n\n$SERVICEOUTPUT$\n" | wget  "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=xyz@demosmsaccount:password&senderID=XYZ&receipientno=992992922&dcs=0&msgtxt=**  Type : $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is  $SERVICESTATE$ at: $LONGDATETIME$ **"
   }

#entries for user2

#Host outage notification entries section

#  'notify-host-by-sms' command definition for solutionsatexperts-and-appsupport
   define  command{
           command_name    notify-host-by-user2
           command_line    /usr/bin/printf "%b" "*****  Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState:  $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time:  $LONGDATETIME$\n" | wget  "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=xyz@demosmsaccount.com:password&senderID=XYZ&receipientno=99299222&dcs=0&msgtxt=**  Type : $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ at:  $LONGDATETIME$ **"
     }

#Service outage notification entries section

#  'notify-service-by-sms' command definition for solutionsatexperts-and-appsupport
   define  command{
           command_name    notify-service-by-user1
           command_line    /usr/bin/printf "%b" "*****  Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:  $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState:  $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional  Info:\n\n$SERVICEOUTPUT$\n" | wget  "http://api.mVaayoo.com/mvaayooapi/MessageCompose?user=xyz@demosmsaccount.com:password&senderID=XYZ&receipientno=992992922&dcs=0&msgtxt=**  Type : $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is  $SERVICESTATE$ at: $LONGDATETIME$ **"
   }

Step 2

Add  users contact details  in  command.cfg configuration file for user1 and user2 .

[root@monitoring ~]# vi  /usr/local/nagios/etc/objects/contacts.cfg

 

 

Create contact group and list all associated users who has SMS alert notification enable in command.cfg configuration file as described in above steps.

 

 

Step 3

It is the time to enable SMS notification on service or host outage, edit  any of the remote client monitoring configuration file, by default all configuration files associated to remote client machines are located (/usr/local/nagions/etc/objects) .

 

If you want to set globally which applies to all services and hosts, whenever any deviation occurs in service or host, SMS notification triggers all users who are member of SMS_GROUP.

 

If are looking forward to send notification on any of service outage as indicated below.

SMS integration is completed. Now go and test results.

SMS integration with Nagios or Nagios alerts on Mobile, Nagios integration with SMS gateway. how to integrate nagios with SMS,nagios SMS integration steps

Both comments and pings are currently closed.

Comments are closed.

Copyright ©Solutions@Experts.com
Copyright © NewWpThemes Techmark Solutions - www.techmarksolutions.co.uk