Xymon Mailing List Archive search

alert e-mail scripts

4 messages in this thread

list Kevin King · Thu, 27 Sep 2018 14:59:12 +0000 ·
Xymoners,

I am running 4.3.28 xymon. I am working on a newer server that I want to use a custom script for the e-mail. I have a couple of old e-mail scripts that I used in the past. They are just simple scripts to test all your variables pass and it sends a mail. I use this to test and build the new script I want. Ok so nothing is working like it should. The sript will run from command line but when I run it from the alert.cfg file, it just puts "no mail" in the log. It is like it is trying to read mail and not send it.

I have not gone back and looked to see if mail scripts work differently. I even searched the archive mail for some sample scripts.
Here is the line from alerts.cfg
CLASS=%MP  COLOR=red
        MAIL ltxxxx at xxx jlxxxx at xxx kkxxxx at xxx REPEAT=1d TIME=*:0730:2100
        SCRIPT /usr/local/xymon/server/ext/mail_generic.ksh kkxxxx at xxx

Here is my script (sample from mail archives):

#!/usr/bin/ksh
RECIPIENT=$1
LOGGROUP=$2
CALL_LEVEL=medium
[ "$BBCOLORLEVEL" = "RED" ] && CALL_LEVEL=high

echo '
Hi $RECIPIENT

Please log a $CALL_LEVEL call to $LOGGROUP, with the subject
\"$BBHOSTNAME - $BBSVCNAME problem - Please Investigate.\"
Please include this link in the service call ticket for more information
$(echo $BBALPHAMSG | grep http)

Thanks
    Monitoring.
' | mailx $RECIPIENT


From alert.log

Received reload request
Received reload request
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
No mail.
Received reload request
Received reload request
Received reload request
Received reload request

Kevin H. King *
"You can not please everyone everyday, But everyday please everyone you can" -me
list Adam Goryachev · Fri, 28 Sep 2018 09:15:23 +1000 ·
On 28/09/18 00:59, KING, KEVIN wrote:
Thanks

    Monitoring.

' | mailx $RECIPIENT
Check "man mailx", it would seem you have a newer version (or version 
supplied by a different package) and might need to adjust some 
parameters/options/config.

Also, verify that $RECIPIENT has a value when called from xymon.

Regards,
Adam

-- 
Adam Goryachev
Website Managers
P: +61 2 8304 0000                    user-eaec2ffb4cbc@xymon.invalid
F: +61 2 8304 0001                     www.websitemanagers.com.au
list Adam Goryachev · Fri, 28 Sep 2018 09:32:09 +1000 ·
quoted from Adam Goryachev
On 28/09/18 00:59, KING, KEVIN wrote:
Thanks

    Monitoring.

' | mailx $RECIPIENT
Check "man mailx", it would seem you have a newer version (or version 
supplied by a different package) and might need to adjust some 
parameters/options/config.

Also, verify that $RECIPIENT has a value when called from xymon.

Regards,
Adam
-- 

The information in this e-mail is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this e-mail by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you have received this message
in error, please notify us immediately. Please also destroy and delete the
message from your computer. Viruses - Any loss/damage incurred by receiving
this email is not the sender's responsibility.
-- 
Adam Goryachev Website Managers www.websitemanagers.com.au
list Kevin King · Fri, 28 Sep 2018 12:23:43 -0400 ·
Adam, Here is what I found. Running the script as xymon in the xymon env, it worked fine. But when called from the alert.cfg it did not. It seams when called from the alert file the options are not passed to the script as $1 $2 etc. when I changed $ RECIPIENT to $RCPT and removed the $RECIPIENT=$1.

Sent from Mail for Windows 10
quoted from Adam Goryachev

From: Adam Goryachev
Sent: Friday, September 28, 2018 12:54 AM
To: xymon at xymon.com
Subject: Re: [Xymon] alert e-mail scripts

On 28/09/18 00:59, KING, KEVIN wrote:

Thanks
    Monitoring.
' | mailx $RECIPIENT
 
 

Check "man mailx", it would seem you have a newer version (or version supplied by a different package) and might need to adjust some parameters/options/config.

Also, verify that $RECIPIENT has a value when called from xymon.

Regards,
Adam

-- 
Adam Goryachev
Website Managers
P: +61 2 8304 0000                    user-eaec2ffb4cbc@xymon.invalid
F: +61 2 8304 0001                     www.websitemanagers.com.au