Browse Source

bugfix !nagios list -- asr

Gaétan RYCKEBOER 10 years ago
parent
commit
5d03c6581d
1 changed files with 8 additions and 5 deletions
  1. 8 5
      bin/nagios-fifo.pl

+ 8 - 5
bin/nagios-fifo.pl

@@ -610,18 +610,20 @@ sub event_privmsg($$$$) {
 				" ".scalar @ACKS." alertes");
 		}
 		elsif ($arg =~ /^list ?(.*)/i) {
-			$server->command ( "msg  ".$nagios_ack_channel.
-				" ".scalar @ACKS." alertes");
 			my $i=0;
 
 			# Do you search on pattern (whole database), or a list (reduced database) ?
 			my $grepto;
 			my $motif=$1;
-			$motif=s/^ack$/0\$/i;
-			$motif=s/^unack$/1\$/i;
-			$motif="" unless defined($motif) ;
 			my $search_unack=0; 
+
+			$server->command ( "msg  ".$nagios_ack_channel.
+				" ".scalar @ACKS." alertes");
+			$motif="" unless defined($motif) ;
+			$motif="0\$" if $motif =~ /^ack$/i;
+			$motif="1\$" if $motif =~ /^unack$/i;
 			$search_unack="1" if $motif eq "";
+			Irssi::print(">> List : $motif");
 
 			foreach $K (@ACKS) {
 				my $grepto="#$i @$K";
@@ -648,6 +650,7 @@ sub event_privmsg($$$$) {
 				" !nagios check <#ALERTE> TODO : recheck une alerte donnée (service/host)");
 			$server->command ( "msg  ".$nagios_ack_channel.
 				" !nagios refresh [silent] [clear] : interroge le nagios pour avoir la liste de toutes les alertes");
+			$server->command ( "msg  ".$nagios_ack_channel.
 				"                                    si le mot clef 'clear' est ajouté, il purge les alertes locales");
 		} elsif ( $arg =~ /^check ?(.*)/i ){
 			nagios_check($1,$server,undef);