Page 1 of 1

SMS Gateway Issue

Posted: Tue Nov 11, 2014 1:12 pm
by l_freez
Hi !

I’m configured nagios core to send sms notifications using this article.

http://www.sms-integration.com/how-to-s ... s-110.html

Its working fine but I’m using Ozeki NG SMS Gateway 20 day trial software
. I already have registered version of Now SMS/MMS Gateway v2013.11.15 sofware. So I need to use it for sending nagios notifications.

I used this shell script for send sms notifications through the Ozeki NG SMS Gateway and its working well

#!/bin/bash
url1="http://10.238.81.55:9501/api?action=sendmessage&username=admin&password=pass@123&recipient=0123456789&messagetype=SMS:TEXT&messagedata="
url2="$@"
url2+=$(php -r "echo rawurlencode('$(sed "s/'/\\\\'/g" <<< )');")
url=$url1+$url2
wget -O- "$url"

actually I haven’t good knowledge for shell scripting. I simply change URL,port no, username,password,phone number in above shell script according to my Now SMS/MMS Gateway settings.

#!/bin/bash
url1="http://10.200.197.20:7474/api?action=sendmessage&username=admin&password=pass@123&recipient=0123456789&messagetype=SMS:TEXT&messagedata="
url2="$@"
url2+=$(php -r "echo rawurlencode('$(sed "s/'/\\\\'/g" <<< )');")
url=$url1+$url2
wget -O- "$url"

when I execute this script its showing below message

[root@localhost ~]# /usr/local/nagios/libexec/sms_send.sh
/usr/local/nagios/libexec/sms_send.sh: command substitution: line 5: syntax error near unexpected token `)'
/usr/local/nagios/libexec/sms_send.sh: command substitution: line 5: `sed "s/'/\\\\'/g" <<< )');"'
--2014-11-11 22:45:50-- http://10.200.197.20:7474/api?action=se ... sagedata=+
Connecting to 10.200.197.20:7474... connected.
HTTP request sent, awaiting response... 401 Authorization Required
Authorization failed.

Please can someone help me to resolve this issue.

Re: SMS Gateway Issue

Posted: Tue Nov 11, 2014 1:38 pm
by slansing
It looks like it's having trouble passing the authentication through http, are you use the username/pass are correct? Have you contacted their team to see if someone has had this issue before with that script?

Re: SMS Gateway Issue

Posted: Tue Nov 11, 2014 1:52 pm
by l_freez
slansing wrote:It looks like it's having trouble passing the authentication through http, are you use the username/pass are correct? Have you contacted their team to see if someone has had this issue before with that script?
username/password are correct. using web browser I can logging to this address http://10.200.197.20:7474 and send sms :roll:

no, i didn't contact them. :?

Re: SMS Gateway Issue

Posted: Wed Nov 12, 2014 12:07 am
by Box293
does your password have any special characters?

Re: SMS Gateway Issue

Posted: Wed Nov 12, 2014 1:37 am
by l_freez
Box293 wrote:does your password have any special characters?
no. its pass@123

Re: SMS Gateway Issue

Posted: Wed Nov 12, 2014 6:02 pm
by abrist
Well, the script has syntax errors:

Code: Select all

/usr/local/nagios/libexec/sms_send.sh: command substitution: line 5: syntax error near unexpected token `)'
/usr/local/nagios/libexec/sms_send.sh: command substitution: line 5: `sed "s/'/\\\\'/g" <<< )');"'
And I would assume those errors are responsible for the credentials not being passed correctly.
Have you contacted the vendor from the page you linked to inform them of the issue?