# 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@@";
$debug = $restart = $kill = 0;
if (! GetOptions("debug:i" => \$debuglevel, "restart" => \$restart,
- "kill" => \$kill, "test" => \$test) ) {
+ "kill" => \$kill, "test" => \$test ) ) {
&usage();
exit 1;
}
}
} 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 );
}
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 {