Page 1 of 1

Send Alerts through SMS

Posted: Wed May 23, 2018 5:33 am
by acvillaester
Hi,

Please help me configure sending alerts through SMS.
I've googled but most of them need third party(sms provider) that we need to pay.

Thanks and Godbless!!

Re: Send Alerts through SMS

Posted: Wed May 23, 2018 12:33 pm
by tmcdonald
Most of them will. Nagios does not have a built-in SMS module, but depending on your SMS provider you might be able to send an email to a special address which will forward to SMS:

https://www.digitaltrends.com/mobile/ho ... l-account/

Re: Send Alerts through SMS

Posted: Thu May 24, 2018 9:37 am
by mcapra
Twilio has a free-tier that I've successfully integrated into Nagios Core without too much trouble.

Here's what I'm using as my notification handlers (sanitized of my credentials of course):

Code: Select all

define command {
        command_name    notify-service-by-twilio
        command_line    curl 'https://api.twilio.com/2010-04-01/Accounts/<account>/Messages.json' -X POST --data-urlencode 'To=$CONTACTPAGER$' --data-urlencode 'From=<twilio_number>' --data-urlencode 'Body=NAGIOS: $HOSTNAME$--$SERVICEDESC$--$SERVICESTATE$' -u <credentials>
}

define command {
        command_name    notify-host-by-twilio
        command_line    curl 'https://api.twilio.com/2010-04-01/Accounts/<account>/Messages.json' -X POST --data-urlencode 'To=$CONTACTPAGER$' --data-urlencode 'From=<twilio_number>' --data-urlencode 'Body=NAGIOS: $HOSTNAME$--$HOSTSTATE$' -u <credentials>
}
And my corresponding contact definition:

Code: Select all

define contact {
        contact_name                    matt.capra
        use                             generic-contact
        email                           <my_email>
        pager                           <my_cell_number>
}

Re: Send Alerts through SMS

Posted: Fri May 25, 2018 10:58 am
by kyang
Thanks for the help @mcapra!