|
From: Bob T. <bt...@us...> - 2004-08-02 15:52:32
|
Update of /cvsroot/benson/benson3/handlers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32211 Modified Files: A10email.pm Log Message: The latest email handler, with bug fixes. Index: A10email.pm =================================================================== RCS file: /cvsroot/benson/benson3/handlers/A10email.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** A10email.pm 14 May 2004 03:10:32 -0000 1.11 --- A10email.pm 2 Aug 2004 15:52:23 -0000 1.12 *************** *** 80,85 **** my %hash; $hash{line_count} = $rule->{name}; ! $hash{count} = $rule->{count} || ".*"; $hash{starttime} = $rule->{time}->{start}; $hash{endtime} = $rule->{time}->{end}; --- 80,92 ---- my %hash; + $hash{last} = $rule->{last}; $hash{line_count} = $rule->{name}; ! $hash{count} = $rule->{count}; ! if(!defined $rule->{count}) { ! $hash{count} = ".*"; ! } ! if($rule->{count} eq "*") { ! $hash{count} = ".*"; ! } $hash{starttime} = $rule->{time}->{start}; $hash{endtime} = $rule->{time}->{end}; *************** *** 357,360 **** --- 364,368 ---- } + $s->trace("M ($identity) total=$total rule->count=".$rule->{count}, 4); if($agent_found && $severity_found && $subsystem_found && $message_found && *************** *** 379,390 **** } if($rule->{pass} eq "+") { last; } } else { ! my $total_matched = $agent_found + $severity_found + $subsystem_found + ! $message_found + $self->match_total_count($total, $rule->{count}) + ! $self->match_weekday_time($rule->{starttime}, $rule->{endtime}, $rule->{weekday}); ! $s->trace("C ($identity) did not match ($total_matched/6) on $filename:$line_count", 4); } } --- 387,424 ---- } + $s->trace("C ($identity) pass = ".$rule->{pass}." last=".$rule->{last}, 4); if($rule->{pass} eq "+") { + $s->trace("C ($identity) pass stopping processing"); + last; + } + if($rule->{last} eq "yes") { + $s->trace("C ($identity) last stopping processing"); last; } } else { ! my $total = $self->match_total_count($total, $rule->{count}); ! my $weekday_time = $self->match_weekday_time($rule->{starttime}, $rule->{endtime}, $rule->{weekday}); ! my $total_matched = $agent_found + $severity_found + $subsystem_found + $message_found + $total + $weekday_time; ! my $not_matched_on = "("; ! if(!$agent_found) { ! $not_matched_on .= "agent:"; ! } ! if(!$severity_found) { ! $not_matched_on .= "severity:"; ! } ! if(!$subsystem_found) { ! $not_matched_on .= "subsystem:"; ! } ! if(!$message_found) { ! $not_matched_on .= "message:"; ! } ! if(!$total) { ! $not_matched_on .= "total:"; ! } ! if(!$weekday_time) { ! $not_matched_on .= "weekday_time:"; ! } ! $not_matched_on .= ")"; ! $s->trace("C ($identity) did not match ($total_matched/6)$not_matched_on on $filename:$line_count", 4); } } *************** *** 439,443 **** foreach my $email (keys %{$emails}) { $s->trace("M ($identity) Sending alert email to $email", 3); ! # $self->send_email($email, $t); } --- 473,477 ---- foreach my $email (keys %{$emails}) { $s->trace("M ($identity) Sending alert email to $email", 3); ! $self->send_email($email, $t); } |