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.
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.
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
From: Xymon <xymon-bounces at xymon.com> on behalf of Root, Paul T <Paul.Root at CenturyLink.com> 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.
participants (3)
-
erik@schminke.us
-
Paul.Root@CenturyLink.com
-
Phil.Crooker@orix.com.au