From: Stephen L Johnson Date: Sun, 30 Jan 2000 08:01:40 +0000 (+0000) Subject: Fixed problem with np_file remove logic. They should only be deleted if X-Git-Tag: spong-2_7-alpha5~107 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c25694a232fd58886f4a31551b70bdbaf17b074;p=spong.git Fixed problem with np_file remove logic. They should only be deleted if $SEND_MESSAGE is 'RED' because spong-message is not called. --- diff --git a/src/spong-server.pl b/src/spong-server.pl index 3bf583f..f6ea842 100755 --- a/src/spong-server.pl +++ b/src/spong-server.pl @@ -724,11 +724,6 @@ sub message_user { if ( $cmd eq "status" ) { - # Remove current np files if event is a change in status (i.e. dur = 0) - if ( $duration == 0 ) { - &remove_np_files($host,$service); - } - # If the color is 'red' and duration is non-zero, call spong-message for # escalation notifications if ($color eq 'red' && $duration != 0) { @@ -744,6 +739,14 @@ sub message_user { &debug("change in state to red, messaging a human",2); &send_message( $host, $service, $color, $time, $sum, $duration ); } + + # Remove current np file if service has recovered + # Normally this would be done in spong-message, but spong-messsage + # is not called when $SEND_MESSAGE = "RED" for recovery events + if ( $duration == 0 && $color ne 'red' ) { + &remove_np_files($host,$service); + } + } elsif ( $SEND_MESSAGE eq "RED-CHANGE" ) { # If status has changed and either color is red, call spong-message if ( ( -f "$SPONGDB/$host/services/$service-red" or $color eq "red" )