[hobbit] integrate hobbit with trouble ticket system?

Charles Jones jonescr at cisco.com
Tue Jan 3 19:42:44 CET 2006


Here is the "scrip" I made for BigBro->RT.  Basically I sent a copy of 
all BigBrother alerts to RT via the normal email gateway method, which 
creates a ticket in the RT system.

The following RT Scrip basically does the following:
1. Recognizing a resolved message via the resolved numeric code 
(0000000) in the subject*
2. Parsing the BB event ID from the subject of the resolved message.
3. Search out the initial alert ticket that has the same ID
4. If nobody has claimed the ticket, set its status to resolved, and add 
a note to the ticket indicating it was auto-resolved (This is by design 
as I didn't want to auto-resolve tickets that a tech had claimed and was 
working on).
5. Delete the ticket created by the recovery message (otherwise these 
accumulate).

*Note: Big Brother puts the alert ID in the resolved page, by default 
Hobbit does not, so this will NOT work for Hobbit out of the box..  This 
can perhaps be accomodated by either using a custom paging script, or 
modifying the way Hobbit creates the subject line of recovery pages.

The scrip uses the RT API, which looks a bit confusing if you don't know 
the object names (Jesse helped me there), but the only thing that should 
need tweaking is the regular expression in the first line, which matches 
the standard BB recovery subject and parses out the event ID.

I havn't used RT in some time, so I cannot guarantee this will work on 
the latest version.
If you are new to RT, please read up on RTs use of "Scrips" before you 
try to implement this.

--- start paste ---
[cjones at crimson misc]$ cat RT-AutoResolveScrip.pl
if ($self->TicketObj->Subject =~ /\!BB - 0000000\!.+(\d+)/) { # Detect 
BB recovery page and parse ID
  $RT::Logger->debug('############# AUTORESOLVING TICKET ################');
  my $id = $1;
  my $tickets = new RT::Tickets($RT::SystemUser); # Open a new ticket
  $tickets->LimitQueue(VALUE => ($self->TicketObj->QueueObj->Id));
  $tickets->LimitStatus(VALUE => 'new');
  $tickets->LimitStatus(VALUE => 'open');
  while (my $ticket = $tickets->Next) { #Loop through all the new and 
open tickets.
        next if ($ticket->Subject!~/$id/); #Ignoring ones that do not 
have the same event id.
        $self->TicketObj->AddLink( Type => 'MemberOf', Target 
=>$ticket->Id); #Link it to the alert ticket.
        $ticket->SetStatus('resolved') if ($ticket->OwnerObj->Name 
=~/Nobody/); #Resolve if nobody claimed it.
        my $mimeobj = MIME::Entity->new();
        $mimeobj->build(Type => 'text/plain', Data => 'Auto Resolved by 
Big Brother'); #Add a comment.
        $ticket->_NewTransaction(
                 Type      => 'Comment',
                 MIMEObj     => $mimeobj,
        );
  }
  # Delete the BB recovery generated ticket.
  $self->TicketObj->SetStatus('deleted') ;
}
return 1;
---- end paste ----


-Charles


Asif Iqbal wrote:

>I know Charles Jones--member of this community--integrated Bigbrother with RT. 
>He may explain you more. Also there was another person who integrated nagios with RT. 
>
>You may be able to search the RT mail archive through google to get
>specifics
>
>On Fri, Dec 30, 2005 at 10:20:07AM, Marco Avvisano wrote:
>  
>
>>Anyone have integrated hobbit with trouble system ?
>>
>>I'm tryng Request Tracker, it seems a good tool 
>>
>>http://www.bestpractical.com/products.html
>>
>>
>>Marco
>>    
>>



More information about the Xymon mailing list