Cristian Livadaru's blog

... think again ...

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.