From f4d521416e65754141e038663c329dfb6988ee92 Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Sat, 26 Jul 2003 20:36:46 +0000 Subject: [PATCH] added matching term for color/status --- src/spong-message.pl | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/spong-message.pl b/src/spong-message.pl index 7e343ab..2657ae9 100755 --- a/src/spong-message.pl +++ b/src/spong-message.pl @@ -10,7 +10,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.39 2003/05/11 02:57:42 sljohnson Exp $ +# $Id: spong-message.pl,v 1.40 2003/07/26 20:36:46 sljohnson Exp $ use lib "@@LIBDIR@@"; @@ -416,11 +416,37 @@ RULE: } } + # + # Match on colors or status + # + + if ( ! defined $rule->{'colors'} and + ! defined $rule->{'status'} ) { + + debug("Color/Status default match for $color on rule $c $rule->{'name'}"); + } else {a + $m = 0; + + # Scan though each color in the rule + foreach my $clr ( @{$rule->{'colors'}}, + @{$rule->{'status'}} ) { + if ($color eq $clr) { + $m = 1; last; + } + } + + if ( ! $m ) { + debug("No color/status match for $color on rule $c $rule->{'name'}"); next RULE; + } else { + debug("Color match for $color on rule $c $rule->{'name'}"); + } + } + # # Match on hosts and host_groups # - # If no matech elements defined, match automatically + # If no match elements defined, match automatically if ( ! defined $rule->{'hosts'} && ! defined $rule->{'host_groups'} ) { &debug("Host match for $host on rule $c $rule->{'name'}"); -- 2.30.2