From a00c5edb2dcb8b5e476bc4be651b35e869e7da6f Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Sun, 11 May 2003 02:57:42 +0000 Subject: [PATCH] Added exclude_colors and include_color global matching rule --- src/spong-message.pl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/spong-message.pl b/src/spong-message.pl index 3ded1f3..7e343ab 100755 --- a/src/spong-message.pl +++ b/src/spong-message.pl @@ -1,18 +1,16 @@ -#!@@PERL@@ +#!/usr/bin/perl # # Spong messaging program. This script gets called when something that spong # is monitoring goes red. This script then runs through a number of tests # to decided if, who, and how to send a message to someone letting them know -# of the problem. Currently this script only knows how to send email and -# send messages to skytel pagers (currently it does it via email as well - but -# I will soon try doing it vi the skytel web server). +# of the problem. # # History: # (1) Created (Ed Hill Mar 14, 1997) # (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.38 2002/11/07 21:59:18 sljohnson Exp $ +# $Id: spong-message.pl,v 1.39 2003/05/11 02:57:42 sljohnson Exp $ use lib "@@LIBDIR@@"; @@ -134,6 +132,9 @@ if (! $DATEFMT) { $DATEFMT = "%m/%d/%y"; } if (! $TIMEFMT) { $TIMEFMT = "%H:%M:%S"; } if (! $DATETIMEFMT) { $DATETIMEFMT = "%c"; } +# If notifications are turned off, just exit +if ( $SEND_MESSAGE eq 'NONE' ) { exit 0; } + # Read the little message history database, so we can prevent message overload $history_db = "$SPONGDB/.message-history"; @@ -328,25 +329,24 @@ sub scan_rules { # # Check excluded colors - if ( defined($GLOBAL_FILTERS{'exclude_colors'} ) { + if ( defined($GLOBAL_FILTERS{'exclude_colors'} )) { foreach my $mcolor ( $GLOBAL_FILTERS{'exclude_colors'} ) { if ( $color eq $mcolor ) { - main::debug("Hit on exclude_colors in default filters"; + main::debug("Hit on exclude_colors in default filters"); return; } } } - if ( defined( $GLOBAL_FILTERS{'include_colors'} ) { + if ( defined( $GLOBAL_FILTERS{'include_colors'} )) { my $hit = 0; foreach my $mcolor ( $GLOBAL_FILTERS{'include_colors'} ) { - if $color eq $mcolor || $mcolor eq 'all' { + if ( $color eq $mcolor || $mcolor eq 'all' ) { $hit = 1; last; } } - } if (! $hit ) { - main::debug("No Hit on include_colors in default filters"; + main::debug("No Hit on include_colors in default filters"); return; } } -- 2.30.2