SMS Gateway Issue

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
l_freez
Posts: 13
Joined: Sat Oct 25, 2014 3:06 pm

SMS Gateway Issue

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: SMS Gateway Issue

Post 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?
l_freez
Posts: 13
Joined: Sat Oct 25, 2014 3:06 pm

Re: SMS Gateway Issue

Post 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. :?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: SMS Gateway Issue

Post by Box293 »

does your password have any special characters?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
l_freez
Posts: 13
Joined: Sat Oct 25, 2014 3:06 pm

Re: SMS Gateway Issue

Post by l_freez »

Box293 wrote:does your password have any special characters?
no. its pass@123
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: SMS Gateway Issue

Post 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?
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