Nagios sms notification not working

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Boobless
Posts: 2
Joined: Wed Dec 04, 2013 5:06 am

Nagios sms notification not working

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios sms notification not working

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Boobless
Posts: 2
Joined: Wed Dec 04, 2013 5:06 am

Re: Nagios sms notification not working

Post 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.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios sms notification not working

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked