Hi sunnavy, Setup seems good. No error message.
Thanks. I am reading your documentation on url : http://cpan.uwinnipeg.ca/htdocs/RT-Extension-Nagios/ Regards, Rodolphe 2009/11/3 sunnavy <sunn...@bestpractical.com> > Hi Rodolphe > > It's a bug, I'm sorry for that. > please test the new version attached. > > best wishes > sunnavy > > On 09-11-02 15:16, Rodolphe ALT wrote: > > Hi Sunnavy, > > > > Thanks a lot for this tip, because on the link ( > > http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages) it > was > > not wrote. > > > > I have read the file README. > > > > After make and install, I have add this line in file > > /opt/rt3/etc/RT_SiteConfig.pm > > Set(@Plugins,qw(RT::Extension::Nagios)); > > > > But when I have initialized database (make initdb), i have a message > error : > > [Mon Nov 2 13:30:56 2009] [error]: Action 'Nagios' not found > > (/opt/rt3/sbin/../lib/RT/Handle.pm:987) > > > > And the scrip after that doesn't close always any messages. In the log : > > [Mon Nov 2 13:45:32 2009] [debug]: Committing scrip #13 on txn #451 of > > ticket #55 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190) > > [Mon Nov 2 13:45:32 2009] [debug]: Found a recovery msg: ((eval > 3253):18) > > > > And that's all. > > > > > > > > > > > > Regards, > > > > Rodolphe > > > > > > The scrip > > > > --------------------------------- > > > > # If the subject of the ticket matches a pattern suggesting > > # that this is a Nagios RECOVERY message AND there is > > # an existing ticket (open or new) in the "General" queue with a matching > > # "problem description", (that is not this ticket) > > # merge this ticket into that ticket > > # > > # Based on > http://marc.free.net.ph/message/20040319.180325.27528377.en.html > > > > my $problem_desc = undef; > > > > my $Transaction = $self->TransactionObj; > > my $subject = $Transaction->Attachments->First->GetHeader('Subject'); > > #if ($subject =~ /\*\* RECOVERY (\w+) - (.*) OK \*\*/) { > > if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) { > > # This looks like a nagios recovery message > > $problem_desc = $2; > > > > $RT::Logger->debug("Found a recovery msg: $problem_desc"); > > } else { > > $RT::Logger->debug("Not a recovery msg: $problem_desc"); > > return 1; > > } > > > > # Ok, now let's merge this ticket with it's PROBLEM msg. > > my $search = RT::Tickets->new($RT::SystemUser); > > $search->LimitQueue(VALUE => 'General'); > > $search->LimitStatus(VALUE => 'new', OPERATOR => '=', ENTRYAGGREGATOR => > > 'or'); > > $search->LimitStatus(VALUE => 'open', OPERATOR => '='); > > > > if ($search->Count == 0) { return 1; } > > my $id = undef; > > while (my $ticket = $search->Next) { > > # Ignore the ticket that opened this transation (the recovery one...) > > next if $self->TicketObj->Id == $ticket->Id; > > # Look for nagios PROBLEM warning messages... > > if ( $ticket->Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) { > > if ($2 eq $problem_desc){ > > # Aha! Found the Problem TICKET corresponding to this > RECOVERY > > # ticket > > $id = $ticket->Id; > > # Nagios may send more then one PROBLEM message, right? > > $RT::Logger->debug("Merging ticket " . $self->TicketObj->Id . > " > > into $id because of OA number match."); > > $self->TicketObj->MergeInto($id); > > # Keep looking for more PROBLEM tickets... > > } > > } > > } > > > > $id || return 1; > > # Auto-close/resolve this whole thing > > $self->TicketObj->SetStatus( "resolved" ); > > 1; > > > > > > ----------------------------------- > > > > > > > > 2009/11/2 sunnavy <sunn...@bestpractical.com> > > > > > Hi Rodolphe > > > > > > Maybe you're interested in the RT extension attached, which is based on > the > > > wiki you read. > > > I'm thinking of publishing it to CPAN soon. > > > > > > best wishes > > > sunnavy > > > > > > On 09-11-02 12:00, Rodolphe ALT wrote: > > > > Hi all, > > > > > > > > I am trying create a scrip in RT3 for close automaticly the tickets > from > > > > Nagios alert. > > > > > > > > I am working from the scrips "AutoCloseOnNagiosRecoveryMessages - RT > > > > Integration" from website > > > > > > > > > > > > http://exchange.nagios.org/directory/Addons/Helpdesk-and-Ticketing/RT/AutoCloseOnNagiosRecoveryMessages-%252D-RT-Integration/details > > > > > > > > http://wiki.bestpractical.com/view/AutoCloseOnNagiosRecoveryMessages > > > > > > > > <goog_1257158193783> > > > > > > > > https://wiki.koumbit.net/RequestTracker/NagiosBridge > > > > > > > > > > > > > > > > But with RT3 3.8.6 and Nagios 3.2, The subject of the email is not > > > analyzed > > > > correctly. > > > > > > > > I mean when I have enabled debug log and this is a log messages like > : > > > > [Mon Nov 2 10:30:33 2009] [debug]: Committing scrip #14 on txn #397 > of > > > > ticket #46 (/opt/rt3/bin/../lib/RT/Scrips_Overlay.pm:190) > > > > [Mon Nov 2 10:30:33 2009] [debug]: Message Lancement Scrip 14 ((eval > > > > 2528):12) > > > > [Mon Nov 2 10:30:33 2009] [debug]: Found a recovery msg: ((eval > > > 2528):21) > > > > [Mon Nov 2 10:30:33 2009] [debug]: Boucle 14 : 45 ((eval 2528):36) > > > > [Mon Nov 2 10:30:33 2009] [debug]: Boucle 14 : 46 ((eval 2528):36) > > > > [Mon Nov 2 10:30:33 2009] [debug]: Boucle 14 : 27 ((eval 2528):36) > > > > > > > > And that' all. not Merging ticket ! > > > > > > > > > > > > in scrip, I think this is the line who detect not the ticket : > > > > if ( $ticket->Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is > > > (\w+) > > > > \*\*/ ) { > > > > > > > > I have tested also without success : > > > > if ( $ticket->Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) { > > > > > > > > > > > > And the email subject is like : > > > > ** PROBLEM Service Alert: srv08.athome.local/Portail is CRITICAL ** > > > > ** RECOVERY Service Alert: srv08.athome.local/Portail is OK ** > > > > > > > > > > > > Can you help me to resolve this code ? > > > > > > > > > > > > Thanks, > > > > > > > > Regards, > > > > > > > > Rodolphe > > > > > > > > > > > > ---------------- > > > > > > > > > > > > ALL CODE of actual scrip is here : > > > > > > > > # If the subject of the ticket matches a pattern suggesting > > > > # that this is a Nagios RECOVERY message AND there is > > > > # an existing ticket (open or new) in the "General" queue with a > matching > > > > # "problem description", (that is not this ticket) > > > > # merge this ticket into that ticket > > > > # > > > > # Based on > > > http://marc.free.net.ph/message/20040319.180325.27528377.en.html > > > > > > > > my $problem_desc = undef; > > > > my $report_type = undef; > > > > > > > > $RT::Logger->debug("Message Lancement Scrip 14"); > > > > > > > > my $Transaction = $self->TransactionObj; > > > > my $subject = $Transaction->Attachments->First->GetHeader('Subject'); > > > > if ($subject =~ /\*\* RECOVERY (.*) OK \*\*/) { > > > > # This looks like a nagios recovery message > > > > $report_type = $1; > > > > $problem_desc = $3; > > > > > > > > $RT::Logger->debug("Found a recovery msg: $problem_desc"); > > > > } else { > > > > $RT::Logger->debug("Not a recovery msg: $problem_desc"); > > > > return 1; > > > > } > > > > > > > > # Ok, now let's merge this ticket with it's PROBLEM msg. > > > > my $search = RT::Tickets->new($RT::SystemUser); > > > > $search->LimitQueue(VALUE => 'General'); > > > > $search->LimitStatus(VALUE => 'new', OPERATOR => '=', ENTRYAGGREGATOR > => > > > > 'or'); > > > > $search->LimitStatus(VALUE => 'open', OPERATOR => '='); > > > > > > > > if ($search->Count == 0) { return 1; } > > > > my $id = undef; > > > > while (my $ticket = $search->Next) { > > > > $RT::Logger->debug("Boucle 14 : ".($ticket->Id)); > > > > # Ignore the ticket that opened this transation (the recovery > one...) > > > > next if $self->TicketObj->Id == $ticket->Id; > > > > # Look for nagios PROBLEM warning messages... > > > > if ( $ticket->Subject =~ /\*\* PROBLEM (\w+(?:\s*\d+)?) - (.*) is > > > (\w+) > > > > \*\*/ ) { > > > > if ($2 eq $problem_desc){ > > > > # Aha! Found the Problem TICKET corresponding to this > > > RECOVERY > > > > # ticket > > > > $id = $ticket->Id; > > > > # Nagios may send more then one PROBLEM message, right? > > > > $RT::Logger->debug("Merging ticket " . > $self->TicketObj->Id . > > > " > > > > into $id because of OA number match."); > > > > $self->TicketObj->MergeInto($id); > > > > # Keep looking for more PROBLEM tickets... > > > > $RT::Logger->debug("Scrip 14 : 1 ticket trouvé > $ticket->Id > > > avec > > > > la régle 1!"); > > > > > > > > } > > > > } > > > > > > > > if ( $ticket->Subject =~ /\*\* PROBLEM (\w+) - (.*) (\w+) \*\*/ ) > { > > > > $RT::Logger->debug("Scrip 14 : 1 ticket trouvé $ticket->Id avec > la > > > > régle 2!"); > > > > } > > > > } > > > > > > > > $id || return 1; > > > > > > > > if ($report_type eq "RECOVERY") { > > > > # Auto-close/resolve this whole thing > > > > $self->TicketObj->SetStatus( "resolved" ); > > > > #$Ticket->_Set(Field => 'Status', Value => 'resolved', > RecordTransaction > > > => > > > > 0); > > > > > > > > } > > > > 1; > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ---------------- > > > > > > > _______________________________________________ > > > > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users > > > > > > > > Community help: http://wiki.bestpractical.com > > > > Commercial support: sa...@bestpractical.com > > > > > > > > > > > > Discover RT's hidden secrets with RT Essentials from O'Reilly Media. > > > > Buy a copy at http://rtbook.bestpractical.com > > > > > > >
_______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: sa...@bestpractical.com Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com