From: Stephen L Johnson Date: Sun, 4 Dec 2005 19:37:24 +0000 (+0000) Subject: added --page param and processing for the param X-Git-Tag: spong-2_8_0-beta3^0 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6389983fadb7d76fa70e9488ce4b05faebc4b9b7;p=spong.git added --page param and processing for the param --page param disables ack, host downtime and delay message processing --- diff --git a/src/spong-message.pl b/src/spong-message.pl index 2657ae9..69e9018 100755 --- a/src/spong-message.pl +++ b/src/spong-message.pl @@ -10,7 +10,7 @@ # (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.40 2003/07/26 20:36:46 sljohnson Exp $ +# $Id: spong-message.pl,v 1.41 2005/12/04 19:37:24 sljohnson Exp $ use lib "@@LIBDIR@@"; @@ -26,7 +26,7 @@ local @con; my %opt; @options = ( "help", "host=s", "service=s", "time=i", "color|status=s", "summary=s", "duration=i", "message=s", "file=s", "debug", - "test" ); + "test", "page" ); Getopt::Long::Configure("pass_through"); if( ! GetOptions( \%opt, @options ) ) { &error("Incorrect usage"); exit 1; } @@ -54,9 +54,9 @@ if ( defined $opt{'message'} && defined $opt{'file'} ) { &error("Only one of --message or --file can be specified"); exit 1; } if ( ! defined $duration ) { if ( defined $opt{'duration'} ) { $duration = $opt{'duration'}; } else { $duration = 0; } } -$debug = $opt{'debug'}; +$debug = $opt{'debug'}; $test = $opt{'test'}; - +$page = $opt{'page'}; # This message is a type 'page' message # Handle message file processing if necessary my ( $message ) = ""; @@ -147,7 +147,7 @@ close( HISTORY ); $acks = new Spong::AckList($host); -if (defined $acks) { +if (defined $acks && ! $page) { # If this is a 'page' message, ignore acknowlegements foreach ( $acks->acks() ) { if ( ( $_->services() =~ m/$service/ or $_->services() eq "all" ) and ( $time >= $_->start() and $time <= $_->end() ) ) { @@ -172,7 +172,7 @@ foreach( @{$main::HOSTS{$host}->{'down'}}, my $stotal = $shour * 60 + $smin; my $etotal = $ehour * 60 + $emin; - if( $ntotal >= $stotal && $ntotal <= $etotal ) { + if( $ntotal >= $stotal && $ntotal <= $etotal && ! $page ) { # Ignore downtime for 'page' messages &debug( "problem during downtime, no message will be sent." ); exit(0); } @@ -649,8 +649,12 @@ RULE: # # Logic to decide whether to notifiy this contact or not + # If sending a page, do no delay processing + if ( $page ) { + debug("--page flag setup bypassing delay processing"); + } # If there is special delay processing to be done... - if ( $delay != 0 || $escalate != 0 || $repeat != 0) { + elsif ( $delay != 0 || $escalate != 0 || $repeat != 0) { # If there is no np-file if ( $pagetime eq "") { debug("First attempt notification for $person:$func");