[Xymon] receiving sms alerts...

Metron 6 (six) metron6 at gmail.com
Wed Sep 13 12:59:12 CEST 2017


Hi Steffan,
i tried your script, but one way or another, as sms content arrives only
the first word.
if the text is "mt-PASCHALIDIS-THESSALONIKI:conn red [231490] &red
10.122.90.30 is unreachable"
arrives only this: mt-PASCHALIDIS-THESSALONIKI:conn

if it was: "mt-PASCHALIDIS-THESSALONIKI:conn%20
red%20[231490]%20&red%2010.122.90.30%20is%20unreachable"
arrives ok.. i dont now how to fix this...


On Wed, Sep 13, 2017 at 11:59 AM, Steffan <mailinglist at tikklik.nl> wrote:

> Im using this:
>
> In alerts
>
> script /home/xymon/server/sms/smsalert.pl 31xxxxxx FORMAT=sms
>
>
>
>
>
> /home/xymon/server/sms/smsalert.pl:
>
> =================================
>
> #!/bin/sh
>
>
>
> /home/xymon/server/sms/sendsms.php $RCPT "$BBALPHAMSG"
>
>
>
> /home/xymon/server/sms/sendsms.php:
>
> #!/usr/bin/php
>
> <?php
>
>
>
> $gsm = $argv[1];
>
> $message = $argv[2];
>
> mail('xxxxx at gmail.com', 'Monitor Alert', $message .  $gsm);
>
> $file = fopen("http://www.targetsms.nl/service/sendsms?username=
> xxxx&handle=7840ea16c7f3001fe86152bef5b6b727&aff=32879&soort=SMS&
> originator=Monitor+Alert&to=$gsm&message=$message","r");;
>
> ?>
>
>
>
> *Van:* Xymon [mailto:xymon-bounces at xymon.com] *Namens *Metron 6 (six)
> *Verzonden:* woensdag 13 september 2017 02:47
> *Aan:* Bruce Ferrell <bferrell at baywinds.org>
> *CC:* xymon at xymon.com
> *Onderwerp:* Re: [Xymon] receiving sms alerts...
>
>
>
> i cant get it to work....
>
>
>
> this is from alerts.cfg
>
>
>
>  HOST=%^mt-* SERVICE=conn
>       MAIL ezhellas at gmail.com REPEAT=30 RECOVERED
>       SCRIPT /usr/local/bin/smsalert.sh 306944420303 FORMAT=SMSthis is
> smsalert.sh
>
>
>
> this is smsalert.sh
>
>
>
> #!/bin/bash
> echo "Parameters passed by Xymon to the smsalert.sh script: "$RCPT ":"
> $BBALPHAMSG >> /usr/local/bin/logsms.txt
> /usr/local/bin/sendsms.sh $RCPT $BBALPHAMSG
>
> and this is sendsms.sh
>
>
>
> #!/bin/bash
> RCPTTO=$1
> RCPTTEXT=$2
> echo "parameters passed to sendsms.sh are " $RCPTTO ":" $RCPTTEXT >>
> /usr/local/bin/logsms.txt
> curl -v -u <username>:<password> 'https://www.prosms.gr/secure/
> api/index.php?mobile_number='$RCPTTO'&originator=EZHellas&
> text='$RCPTTEXT'&request_delivery=true' >> /usr/local/bin/logsms.txt
>
>
>
> This is whats written to the log file:
>
>
>
> Parameters passed by Xymon to the smsalert.sh script: 306944420303 :
> mt-PASCHALIDIS-SERRES:conn red [666942] &red 10.122.90.26 is unreachable
> parameters passed to sendsms.sh are  306944420303 :
> mt-PASCHALIDIS-SERRES:conn
> 1|75739990|248
>
>
>
> and of course i receive a cropped sms message...
>
> anyone can help ?
>
>
>
>
>
> On Fri, Sep 8, 2017 at 5:46 PM, Bruce Ferrell <bferrell at baywinds.org>
> wrote:
> >
> > either of these would do the job:
> >
> > php <file that contains the code below>
> >
> > or a script that looks like this (adjust the first line to your php
> location. and define the variables to match the info they gave you):
> >
> >
> > #!/usr/bin/php
> > <?php
> >
> >         // Simple SMS send function
> >
> >         function sendSMS($key, $to, $message, $originator) {
> >
> >                 $URL = "https://smscenter.gr/api/sms/send?key=" . $key
> . "&to=" . $to;
> >
> >                 $URL .= "&text=" . urlencode( $message ) . '&from=' .
> urlencode( $originator );
> >
> >                 $fp = fopen( $URL, 'r' );
> >
> >                 return fread( $fp, 1024 );
> >
> >         }
> >
> >         // Example of use
> >
> >         $response = sendSMS( 'myapikey', 'recipientnumber', 'My test
> message', 'from' );
> >
> >         echo $response;
> >
> > ?>
> >
> >
> >
> > On 9/8/17 7:17 AM, Metron 6 (six) wrote:
> >
> > hello all,
> >
> > i got a subscription to an SMS gateway, and the script they gave me is
> this:
> >
> > ------------
> >
> > <?php
> >
> >         // Simple SMS send function
> >
> >         function sendSMS($key, $to, $message, $originator) {
> >
> >                 $URL = "https://smscenter.gr/api/sms/send?key=" . $key
> . "&to=" . $to;
> >
> >                 $URL .= "&text=" . urlencode( $message ) . '&from=' .
> urlencode( $originator );
> >
> >                 $fp = fopen( $URL, 'r' );
> >
> >                 return fread( $fp, 1024 );
> >
> >         }
> >
> >         // Example of use
> >
> >         $response = sendSMS( 'myapikey', 'recipientnumber', 'My test
> message', 'from' );
> >
> >         echo $response;
> >
> > ?>
> >
> > -------
> >
> > how could i implement it inside alerts.cfg in order to get sms alerts ?
> >
> >
> >
> > --
> >
> > regards,
> > Metron 6 (six)
> >
> > Metron6 at gmail.com
> >
> >
> >
> > _______________________________________________
> > Xymon mailing list
> > Xymon at xymon.com
> > http://lists.xymon.com/mailman/listinfo/xymon
> >
> >
> >
> > _______________________________________________
> > Xymon mailing list
> > Xymon at xymon.com
> > http://lists.xymon.com/mailman/listinfo/xymon
> >
>
>
>
> --
>
> regards,
> Metron 6 (six)
>
> Metron6 at gmail.com
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>
>


-- 

regards,
Metron 6 (six)

Metron6 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20170913/a5a866ff/attachment.html>


More information about the Xymon mailing list