-#!@@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@@";
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";
#
# 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;
}
}