From 7e6a066d76d6d1b8f5b4dd00464a2035fb565f24 Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Tue, 19 Dec 2000 22:15:13 +0000 Subject: [PATCH] fixed notifiction problem with $SEND_MESSAGE = CHANGE, if status = green and first status message --- src/spong-server.pl | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/spong-server.pl b/src/spong-server.pl index 07ab10a..3a76c0e 100755 --- a/src/spong-server.pl +++ b/src/spong-server.pl @@ -6,7 +6,7 @@ # There are one or more update processes that listen for status updates # from client programs. -# $Id: spong-server.pl,v 1.34 2000/12/19 05:27:35 sljohnson Exp $ +# $Id: spong-server.pl,v 1.35 2000/12/19 22:15:13 sljohnson Exp $ use lib "@@LIBDIR@@"; @@ -36,7 +36,7 @@ $MAX_CHILDREN = 10; $debug = $restart = $kill = 0; if (! GetOptions("debug:i" => \$debuglevel, "restart" => \$restart, - "kill" => \$kill, "test" => \$test) ) { + "kill" => \$kill, "test" => \$test ) ) { &usage(); exit 1; } @@ -1106,7 +1106,13 @@ sub message_user { } } elsif ( $SEND_MESSAGE eq "CHANGE" ) { # If status has changed - if ( ! -f "$SPONGDB/$host/services/$service.$color" ) { + my $firstrun = 1; + foreach my $c ('red','yellow','green') { + if( -f "$SPONGDB/$host/$service.$c" ) { $firstrun = 0; } + } + if ( ! -f "$SPONGDB/$host/services/$service.$color" + and ! ($firstrun and $color eq "green" ) ) { + # If this is the first update, don't page on a green status!! &debug("change in state, messaging a human",2); &send_message( $host, $service, $color, $time, $sum, $duration ); } @@ -1128,8 +1134,8 @@ sub send_message { if ( -f $smessage ) { my @args; push @args,$smessage; - if( $debug >= 3 ) { push @args,'--debug'; } - if( $test ) { push @args,'--test'; } + if( $debug >= 3 ) { push @args,"--debug"; } + if( $test ) { push @args,"--test"; } push @args, $color, $host, $service, $time, $sum, $duration; system(@args); } else { -- 2.30.2