SMS Gateway Issue | Search |
NowSMS Support Forums ⬆ NowSMS Support - SMS Issues ⬆ Archive through April 16, 2015 ⬆ |
◄ ► |
Author | Message | |||
Rasika Lakmal New member Username: L_freez Post Number: 1 Registered: 11-2014 |
Hi ! I'm using Now SMS/MMS Gateway v2013.11.15 software and its working well. Recently I'm planning to configure it with Nagios core for send sms notifications. I used this shell script for send nagios notifications. this script is working. I put my Now SMS gateway URL,port,username,password and my phone number here #!/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" But when I execute above 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. | |||
Des - NowSMS Support Board Administrator Username: Desosms Post Number: 5106 Registered: 08-2008 |
Change the second line to: Hi, The URL string does not seem to be formatted for NowSMS. (See http://www.nowsms.com/doc/submitting-sms-messages/sending-sms-text-messages for URL format examples.) I don't have much experience writing bash scripts, but I think the second line should be modified as follows: url1="http://10.200.197.20:7474/?&user=admin&password=pass@123&phonenumber=01234 56789&text=" Specifically the following changes: action=sendmessage is not a parameter used by NowSMS. username= should be user= recipient= should be phonenumber= messagetype=SMS:TEXT is not a parameter used by NowSMS. messagedata= should be text= -- Des NowSMS Support | |||
Des - NowSMS Support Board Administrator Username: Desosms Post Number: 5107 Registered: 08-2008 |
Ignore the space in the middle of the phone number in my example, that was inserted by the discussion forum software and should not be there. |