Xymon Mailing List Archive search

Limiting repeated messages

5 messages in this thread

list Paul Root · Wed, 8 Feb 2017 15:29:07 +0000 ·
So we have custom tests that developers/maintainers of the application want alerts for just once a day. But we use a script to mail to them pretty printed html, so I can't use REPEAT=1d on the SCRIPT line, and putting REPEAT on the host line doesn't work.

Can I put the REPEAT on its own line?

HOST=NMSRep DURATION>7 SERVICE=LogMasterErr,NMSRepScheduler,NMSRepTask,RepDisc_Issues COLOR=red,yellow,purple RECOVERED
REPEAT=1d
     SCRIPT /usr/local/scripts/html_mail.pl $NG-NMSRep-DEV


Or perhaps, embed the repeat into the argument of the script?

Thanks,
Paul.

This communication is the property of CenturyLink and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
list Mike Burger · Thu, 09 Feb 2017 09:09:38 -0500 ·
quoted from Paul Root
On 2017-02-08 10:29 am, Root, Paul T wrote:
So we have custom tests that developers/maintainers of the application want alerts for just once a day. But we use a script to mail to them pretty printed html, so I can't use REPEAT=1d on the SCRIPT line, and putting REPEAT on the host line doesn't work. 
Can I put the REPEAT on its own line? 
HOST=NMSRep DURATION>7 SERVICE=LogMasterErr,NMSRepScheduler,NMSRepTask,RepDisc_Issues COLOR=red,yellow,purple RECOVERED 
REPEAT=1d 
SCRIPT /usr/local/scripts/html_mail.pl $NG-NMSRep-DEV 
Or perhaps, embed the repeat into the argument of the script? 
Thanks, 
Paul.
Hello, Paul. 
I wonder if it's that you have the entire thing on one line that is the
issue. 
I mention this because I have the following set up for one of my test
systems: 
HOST=in-nvaderax01 
  SCRIPT /usr/local/bin/red-alert-xymon-mail.sh <my email address>
DURATION>1 REPEAT=1m COLOR=red SERVICE=procs,msgs RECOVERED 
I tested it out, just now, by echoing the alarm string into a monitored
log and it works just fine. I got the first alert 1 minute after the
text was detected in my log and another, a minute later.

-- 
Mike Burger
http://www.bubbanfriends.org

"It's always suicide-mission this, save-the-planet that. No one ever
just stops by to say 'hi' anymore." --Colonel Jack O'Neill, SG1
list Erik · Fri, 10 Feb 2017 07:26:21 -0600 ·
Using what you'd provided, here's what I'd put in your alerts.cfg

HOST=NMSRep SERVICE=LogMasterErr,NMSRepScheduler,NMSRepTask,RepDisc_Issues
COLOR=red,yellow,purple RECOVERED
    SCRIPT /usr/local/scripts/html_mail.pl $NG-NMSRep-DEV DURATION>7d
DURATION<14d REPEAT=1d

I moved the duration rules down to the "SCRIPT" line.  I also added a
2nd duration rule to demonstrate you could time box this.  The script
will fire once per day for 7 days, after 7 days.
list Paul Root · Thu, 16 Feb 2017 18:03:22 +0000 ·
That’s what I started with, and that doesn’t work.  Script doesn’t acknowledge the DURATION or REPEAT keywords.
quoted from Erik

From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Erik
Sent: Friday, February 10, 2017 7:26 AM
To: xymon at xymon.com
Subject: Re: [Xymon] Limiting repeated messages

Using what you'd provided, here's what I'd put in your alerts.cfg


HOST=NMSRep SERVICE=LogMasterErr,NMSRepScheduler,NMSRepTask,RepDisc_Issues COLOR=red,yellow,purple RECOVERED

    SCRIPT /usr/local/scripts/html_mail.pl<http://html_mail.pl>; $NG-NMSRep-DEV DURATION>7d DURATION<14d REPEAT=1d
quoted from Paul Root

I moved the duration rules down to the "SCRIPT" line.  I also added a 2nd duration rule to demonstrate you could time box this.  The script will fire once per day for 7 days, after 7 days.

This communication is the property of CenturyLink and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
list Phil Crooker · Thu, 16 Feb 2017 23:12:11 +0000 ·
I've had a lot of problems with these alert rules - often it is trial and error to determine what combination of parameters works. At times I had to just write a separate rule for the exceptional condition, even though this adds to complexity of alerts.cfg.


I wrote this (rough & ready) script to speed testing - I find it helpful to test small adjustments to rules and as a final check/audit to make sure everything is actually alerting when you think it should. Of course you'll need to adjust the times to suit your schedule...


if [ -z "$1" ]
then
        echo testalerts.sh hostname-in-hosts-cfg  test  colour
        exit 1
else
        host=$1
fi
if [ -z "$2" ]
then
        test=""
else
        test=$2
fi
if [ -z "$3" ]
then
        COLOUR="red"
else
        COLOUR=$3
fi

# before hours = 1435005600
# work time = 1435042049
# after hours early = 1435053556
# after hours late = 1435063556
# weekend daytime = 1434770000
# weekend night = 1434799000

for t in 1435005600 1435042049 1435053556 1435063556 1434770000 1434799000
do
        when=`perl -e "print scalar localtime $t;"`
        echo "


Testing $host for $test for duration=1 minute at $when
"
        # --config=xxxxx  to test non-production alerts.cfg
        xymond_alert --test $host $test --color=$COLOUR --duration=1 --time=$t | egrep " alert |\*\*\*"
        echo "


Testing $host for $test for duration=15 minutes at $when
"
        xymond_alert --test $host $test --color=$COLOUR --duration=15 --time=$t | egrep " alert |\*\*\*"
done
quoted from Paul Root


From: Xymon <xymon-bounces at xymon.com> on behalf of Root, Paul T <user-76fdb6883669@xymon.invalid>
Sent: Friday, 17 February 2017 4:33 AM
To: 'Erik'; xymon at xymon.com
Subject: Re: [Xymon] Limiting repeated messages

That's what I started with, and that doesn't work.  Script doesn't acknowledge the DURATION or REPEAT keywords.

From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Erik
Sent: Friday, February 10, 2017 7:26 AM
To: xymon at xymon.com
Subject: Re: [Xymon] Limiting repeated messages

Using what you'd provided, here's what I'd put in your alerts.cfg


HOST=NMSRep SERVICE=LogMasterErr,NMSRepScheduler,NMSRepTask,RepDisc_Issues COLOR=red,yellow,purple RECOVERED

    SCRIPT /usr/local/scripts/html_mail.pl<http://html_mail.pl>; $NG-NMSRep-DEV DURATION>7d DURATION<14d REPEAT=1d

I moved the duration rules down to the "SCRIPT" line.  I also added a 2nd duration rule to demonstrate you could time box this.  The script will fire once per day for 7 days, after 7 days.

This communication is the property of CenturyLink and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.