From bb9ac47c4a421715b73829860f2bd1164cdadbc9 Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Thu, 21 Dec 2000 00:12:50 +0000 Subject: [PATCH] added exclude_color/exclude_status matching term for matching rules --- pod/spong-message.pod | 1 + pod/spong.message.pod | 11 +++++++++-- src/spong-message.pl | 14 +++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/pod/spong-message.pod b/pod/spong-message.pod index e37cf29..e92402f 100644 --- a/pod/spong-message.pod +++ b/pod/spong-message.pod @@ -296,6 +296,7 @@ Here are some examples to show you possible configurations. { hosts => [ 'gard.cs.school.edu' ], contacts => [ 'unix-staff'], + exclude_colors => ['green','yellow'], }, { hosts => ['www.school.edu'], diff --git a/pod/spong.message.pod b/pod/spong.message.pod index dd49a17..41ecc07 100755 --- a/pod/spong.message.pod +++ b/pod/spong.message.pod @@ -81,13 +81,19 @@ name, the term is considered an exclusion match. A list of one or more regular expressions that are matched against the host name of the status event. If at least one of the expressions matched the service -name, the term is considered an exclusion match.. +name, the term is considered an exclusion match. =item * exclude_host_groups A list of one or more host group names from the F (see L). If the host name of the status event is a member of one of the host groups, the term is considered an exclusion match. +=item * exclude_colors or exclude_status + +A list of one of more status colors ('red', 'yellow', or 'green'). If the +status color is the event matches one of the colors in the list, the term is +considered an exclusion match. + =back And each rule must have the following attributes: @@ -320,11 +326,12 @@ configurations. }, # Let Dwayne in Engineering know when a system does down and dns problems - # except for the test box + # except for the test box and only send him down messages { hosts => ['.*'], services => ['ping','ftp','smtp','dns'], exclude_host => ['tunixt'], + exclude_colors => ['green','yellow'] contacts => [ 'dstucker' ], }, diff --git a/src/spong-message.pl b/src/spong-message.pl index d37e844..19abe85 100755 --- a/src/spong-message.pl +++ b/src/spong-message.pl @@ -12,7 +12,7 @@ # (2) Added rules based paging (Stephen Johnson Nov 14, 1998) # (3) Added checks against Acks and downtime (Stephen Johnson Mar 17, 1999) # -# $Id: spong-message.pl,v 1.20 2000/12/20 22:00:45 sljohnson Exp $ +# $Id: spong-message.pl,v 1.21 2000/12/21 00:12:50 sljohnson Exp $ use lib "@@LIBDIR@@"; @@ -363,6 +363,18 @@ RULE: } } + if( defined $rule->{'exclude_colors'} or + defined $rule->{'exclude_status'} ) { + foreach my $clr ( @{$rule->{'exclude_colors'}}, + @{$rule->{'exclude_status'}} ) { + if( $color eq $clr ) { + debug("Match on exclude color $clr on rule $c," . + " going to next rule"); + next RULE; + } + } + } + # Match on hosts and host_groups if ( ! defined $rule->{'hosts'} && ! defined $rule->{'host_groups'} ) { -- 2.30.2