Free SMS Alerts from Nagios





I have implemented the SMS alerts in nagios with the help of API's of different providers.

Sign up to the clockworksms.com and it will create an API key on the sign up. After the sign up add some free credits for receiving the sms on your number.

Nagios Server Configuration

For the API to work with nagios, we will download the plugin of clockworksms.
https://exchange.nagios.org/directory/Addons/Notifications/SMS/SMS-Notifications-via-Clockwork/details

Download the plugin from the above link and paste it on your nagios server plugin directory.

# cp ~/Downloads/notify_sms.pl /usr/local/nagios/libexec/

After copied the script, make it executable

# chmod +x notify_sms.pl

Then go to your commands file and paste these lines:

# vi /usr/local/nagios/etc/objects/commands.cfg

define command{
command_name notify-by-sms 
command_line $USER1$/notify_sms.pl -k API_KEY -t $CONTACTPAGER$ -f Nagios -m "Service: $SERVICEDESC$nHost: $HOSTNAME$nAddress: $HOSTADDRESS$nState: $SERVICESTATE$nInfo: $SERVICEOUTPUT$nDate: $LONGDATETIME$" 


define command{ 
command_name host-notify-by-sms 
command_line $USER1$/notify_sms.pl -k API_KEY -t $CONTACTPAGER$ -f Nagios -m "Host $HOSTNAME$ is $HOSTSTATE$nInfo: $HOSTOUTPUT$nTime: $LONGDATETIME$" 


API_KEY = Your API key which is generated on sign up

After this add your number on which you want to receive your alerts in contacts file.

# vi  /usr/local/nagios/etc/objects/contacts.cfg

define contact{

service_notification_commands      notify-by-sms
host_notification_commands         host-notify-by-sms

service_notification_commands     notify-service-by-email
host_notification_commands         notify-host-by-email

        contact_name              administrator ;
        use                             generic-contact ;
        alias                            Nagios Admin  ; 
        email                           alerts@abc.com ; 
        pager                          00923421111111 ;

}


Test your SMS alert functionality by taking down Host/Service.

Other few provider are listed below:





Comments

Post a comment

Please give your review or ask question ?