Send SMS Messages with Nagios
-
- Posts: 115
- Joined: Fri Feb 21, 2014 11:44 am
Send SMS Messages with Nagios
I already have Nagios sending email alerts.
I was just wondering how to go about sending sms text alerts.
I don't want to break anything but want to know step by step how to make it also send sms alerts.
I was just wondering how to go about sending sms text alerts.
I don't want to break anything but want to know step by step how to make it also send sms alerts.
-
- Posts: 22
- Joined: Wed Jun 18, 2014 4:15 am
Re: Send SMS Messages with Nagios
in a nutshell, you need to :
1. get an SMS provider and their API url.
2. create new commands for SMS host notification and SMS service notification. Most likely this is similar to mail notification command but it uses wget to call SMS api.
3. change the notification commands defined in contacts to use your new command.
1. get an SMS provider and their API url.
2. create new commands for SMS host notification and SMS service notification. Most likely this is similar to mail notification command but it uses wget to call SMS api.
3. change the notification commands defined in contacts to use your new command.
-
- Posts: 115
- Joined: Fri Feb 21, 2014 11:44 am
Re: Send SMS Messages with Nagios
Not to sound stupid but how do I get an sms provider?
Do I have to sign up for one is there a fee?
Do I have to sign up for one is there a fee?
Re: Send SMS Messages with Nagios
It might not be that difficult. Most cell phones can receive text messages via email. For example on Verizon, you can send an email to your phone number like so:
15551234567@vtext.com
That's how Nagios XI does it, and I have sent SMS to my phone from the command line so Core should handle it just fine.
15551234567@vtext.com
That's how Nagios XI does it, and I have sent SMS to my phone from the command line so Core should handle it just fine.
Former Nagios employee
-
- Posts: 115
- Joined: Fri Feb 21, 2014 11:44 am
Re: Send SMS Messages with Nagios
ok well I have core Where can I find a step by step guide to set it up?
Re: Send SMS Messages with Nagios
http://nagios.sourceforge.net/docs/3_0/ ... ml#contact
I would create a separate contact for SMS than you have for emails, then just add "-sms" to the end of the contact name. Set the address as the proper <phone number>@<carrier> email address and it should work.
I would create a separate contact for SMS than you have for emails, then just add "-sms" to the end of the contact name. Set the address as the proper <phone number>@<carrier> email address and it should work.
Former Nagios employee
-
- Posts: 115
- Joined: Fri Feb 21, 2014 11:44 am
Re: Send SMS Messages with Nagios
Is there a way to limited the nagios sms alerts to only high priority alerts?
Re: Send SMS Messages with Nagios
That really depends on what you mean by high-priority. You can set that contact (the sms-only one) to only receive alerts for critical issues by setting service_notification_options and host_notification_options to "c" only.
Former Nagios employee
-
- Posts: 115
- Joined: Fri Feb 21, 2014 11:44 am
Re: Send SMS Messages with Nagios
Will this tutorial below work on Suse Linux? this looks like a Debian example but I like the simplicity
Code: Select all
1) Create an API in clicatel gateway service
They are providing lots of methods to send sms through their gateway like https, smtp etc. I selected http and create the http API . Its pretty easy with their panel.
2) Define New Command in commands.cfg
# host-notify-by-sms command definition
define command{
command_name host-notify-by-sms
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.clickatell.com/http/sendmsg?user=clicatel-user-name&password=password&&api_id=XXXXX&to=$CONTACTEMAIL$&text='** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ @ $LONGDATETIME$ **'"
}
# service-notify-by-sms command definition
define command{
command_name service-notify-by-sms
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.clickatell.com/http/sendmsg?user=clickatel-user-name&password=password&api_id=XXXXX&to=$CONTACTEMAIL$&text='** $NOTIFICATIONTYPE$ Service Alert: $SERVICEDESC$ on $HOSTNAME$ State: $SERVICESTATE$ @ $LONGDATETIME$ **'"
}
3) Use new command in contacts.cfg
define contact{
contact_name admin
alias Adminlogs
service_notification_period 24×7
host_notification_period 24×7
service_notification_options c,r
host_notification_options d,r
service_notification_commands service-notify-by-sms
host_notification_commands host-notify-by-sms
email 651234567
}
4) Verify nagios configuaration
nagios -v /etc/nagios/nagios.cfg
5) Restart nagios
6) Test and Verify new command
wget "http://api.clickatell.com/http/sendmsg?user=clicatel-user-name&password=password&&api_id=XXXXX&to= 651234567&text=' *** Welcome to adminlogs.info ***'"
-
- Posts: 115
- Joined: Fri Feb 21, 2014 11:44 am
Re: Send SMS Messages with Nagios
no sure what these alert levels mean= service_notification_options c,r
host_notification_options d,r
Thinking if i only use c after each it will only send critical alerts?
host_notification_options d,r
Thinking if i only use c after each it will only send critical alerts?