nagios with sms notification
so finaly I finished seting up nagios on my server to monitor themselves and in case of a problem send me an SMS.
I found a plugin to send the sms on the nagios exchange site but that didn't quite work out of the box.
First problem is that the URL creation will never work, the URL for the message is created before the session id is assigned to the variable, this can't work! The second problem is that the message is sent "as is" for example "Server xy is down" this won't work either! The text has to be url_encoded ( in php, or uri_encode in perl ) so I created a patch which you can download here.
Then the description of the usage on the site is not correct
define command{
command_name service_notify_with_sms
command_line /usr/lib/nagios/plugins/notify_sms -a 1012345 -u myusername_for_gw -p mypassword_for_gw -m '$NOTIFICATIONTYPE$: $HOSTNAME$ is $SERVICESTATE$ ($SERVICEOUTPUT$)' -t $CONTACTPAGER$
}
It should be $OUTPUT$ and not $SERVICEOUTPUT$ but this was the rather minor problem.




The version 1.1 on nagiosexchange.org:
-puts username/password on commandline where any logged in user can see it,
-Clickatell API has an option to authenticate for each message, instead of opening a session, which only requires 1 HTTP request. I’ll try it out.
[MP-138] NAGIOS enhancement: SMS notification capability …
I hope these links could help:
http://cristian.livadaru.net/2006/04/27/nagios-with-sms-notification/
http://www.nagiosexchange.org/Notifications.35.0.html?&tx_netnagext_pi1%5Bp_view%5D=371&tx_netnagext_pi1%5Bpage%5D=10%3A10...
“Clickatell API has an option to authenticate for each message, instead of opening a session, which only requires 1 HTTP request. I’ll try it out.” — how is the procedure for these? Im having a hard time configuring my nagios for clickatell.. Please help. Thanks!!
Not sure, I am using it with authentication when sending each message since I don’t have users on my system so I don’t really care about password showing
You sent an alert without using those plugins check this url http://www.gnu.org/software/wget/manual/html_node/HTTP-Options.html
from their example: http://api.clickatell.com/http/sendmsg?user=xxxxx&password=xxxxx&api_id=xxxxx&to=448311234567&text=Meet+me+at+home you can simply replace xxxx item with information you got and do this to your command config:
define command{
command_name service_notify_with_sms
command_line wget –post-data “user=myusername&password=mypassword$api_id=XXXXXXX&to=’$NOTIFICATIONTYPE$: $HOSTNAME$ is $SERVICESTATE$ ($SERVICEOUTPUT$)’ -t $CONTACTPAGER$
}
I HOPE THIS COULD HELP!!
Sorry but this is the right command:
# clickatell alert ‘host-notify-by-sms’ command definition
define command{
command_name host_notify_with_sms
command_line wget –post-data “user=myusername&password=mypassword&api_id=xxxxxx&to=$CONTACTPAGER$&text= -m ‘$NOTIFICATION$ $HOSTNAME$ is $HOSTSTATE$ ($HOSTOUTPUT$)’” http://api.clickatell.com/http/sendmsg
}
ENJOY!!
Hi cristian!
can you tell me how can i apply your patch? should i replace some text in the old notify_sms or what?
Would be really thankful to you… also my email address is iknewitalready@gmail.com, i would be really greatful if you could add me (on msn, google talk, and on yahoo its iknewit_already) i need a little guidance…
You can download the complete patched file here: http://livadaru.net/cristian/downloads/notify_sms
What are the correct “define command”s for the service and host?