Page 1 of 1

Nagios sms notification not working

Posted: Wed Dec 04, 2013 5:17 am
by Boobless
Hello all,

I have such an api to get sms from nagios

Code: Select all

wget "http://api.netgsm.com.tr/bulkhttppost.asp?usercode=xxx&password=xxx&gsmno=xxx&message='** NAGIOS**'&msgheader=NAGIOS"
working from command line but not working from command line. I restarted nagios succesfully without error. But not getting sms from nagios.

Code: Select all

define command{
        command_name service-notify-by-sms
        command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$ \nState: $HSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | wget "http:///api.netgsm.com.tr/ulkhttppost.asp?usercode=xxx&password=xxx&gsmno=$CONTACTPAGER&message='** $NOTIFICATIONTYPE$ Service Alert: $SERVICEDESC$ on $HOSTNAME$ State: $SERVICESTATE$ @ $LONGDATETIME$ **'&msgheader=NAGIOS" 
}
any help will be appreciated.

I've tried clickatell api, it was working.

Re: Nagios sms notification not working

Posted: Wed Dec 04, 2013 11:43 am
by sreinhardt
As far as I have ever seen, you cannot printf | wget. You might be able to use curl or wget if you have somehow specified those are post parameters, which does not appear to be the case. Instead I think you only want the wget portion of your notification setting.

Re: Nagios sms notification not working

Posted: Thu Dec 05, 2013 4:51 am
by Boobless
Thanks for reply. I guess I got the idea of sending sms via api inside nagios right now :D I did it by writing python and just calling it from command line by giving phone number+host/service detail message arguments.

Re: Nagios sms notification not working

Posted: Thu Dec 05, 2013 11:09 am
by abrist
As far as I know, you cannot really pipe to wget. You can pass post data with "--post-data", but piping to wget will most likely not work.