[Xymon] receiving sms alerts...
Steffan
mailinglist at tikklik.nl
Wed Sep 13 10:59:47 CEST 2017
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 <mailto: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' <https://www.prosms.gr/secure/api/index.php?mobile_number='$RCPTTO'&originator=EZHellas&text='$RCPTTEXT'&request_delivery=true> &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 <mailto: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 <mailto:Metron6 at gmail.com>
>
>
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com <mailto:Xymon at xymon.com>
> http://lists.xymon.com/mailman/listinfo/xymon
>
>
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com <mailto:Xymon at xymon.com>
> http://lists.xymon.com/mailman/listinfo/xymon
>
--
regards,
Metron 6 (six)
Metron6 at gmail.com <mailto:Metron6 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20170913/06368769/attachment.html>
More information about the Xymon
mailing list