Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Request Tracker: Users

Look for Existing ticket based on external RT Subject Tag

 

 

Request Tracker users RSS feed   Index | Next | Previous | View Threaded


jbmoles at gmail

Jul 5, 2012, 8:37 AM

Post #1 of 3 (505 views)
Permalink
Look for Existing ticket based on external RT Subject Tag

I'm running RT 4, and we have a external service provider that has their
own RT system. When they create a ticket to us, their RT sends the
notification to the email address associated with our RT. The problem is
that their process is to send a notification on create, then send a message
immediately after with the details. This generates two tickets in system.
Has any one written or modified one of the scrips to look for an existing
ticket with the subject tag from an external RT system, before creating a
new ticket. Basically implement the similar logic that is used for
internal subject tag, but basically same IF (Ticket with External Tag
Exists) -> Update Ticket; Else Create new ticket.

--
It is all fun and games till flying monkeys attack


howard.jones at network-i

Jul 6, 2012, 3:15 AM

Post #2 of 3 (480 views)
Permalink
Re: Look for Existing ticket based on external RT Subject Tag [In reply to]

On 05/07/2012 16:37, Joseph Moles wrote:
> I'm running RT 4, and we have a external service provider that has
> their own RT system. When they create a ticket to us, their RT sends
> the notification to the email address associated with our RT. The
> problem is that their process is to send a notification on create,
> then send a message immediately after with the details. This
> generates two tickets in system. Has any one written or modified one
> of the scrips to look for an existing ticket with the subject tag from
> an external RT system, before creating a new ticket. Basically
> implement the similar logic that is used for internal subject tag, but
> basically same IF (Ticket with External Tag Exists) -> Update Ticket;
> Else Create new ticket.
>
Here's something we used to use to do this - it does create the second
ticket, but then immediately merges it into the first one. I think I got
it from elsewhere originally (which is why it mention Nagios in the
comments). It looks for certain subject line patterns, then finds
existing tickets with a matching subject line - in this case, it's
Smokeping alerts, which tend to come in flurries.

Combine with something to suppress auto-replies to mail from your
supplier's RT system :-)

Scrip Condition: On Create
Action: User Defined
Template: Blank

Action Prep Code:

1;

Action Code:

# If the subject of the ticket matches a pattern suggesting
# that this is a SmokePing Alert message AND there is
# an existing ticket (open or new) in the "General" queue with a matching
# Subject, (that is not this ticket) merge this ticket into that ticket

my $problem_desc = undef;

my $Transaction = $self->TransactionObj;
my $subject = $Transaction->Attachments->First->GetHeader('Subject');
if ($subject =~ /\[SmokeAlert\](.*)/) {
# This looks like a SmokeAlert message
$problem_desc = $2;

$RT::Logger->debug("Found a smokealert msg: $problem_desc");
} else {
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 eq $subject) {
$id = $ticket->Id;
$RT::Logger->debug("Merging ticket " . $self->TicketObj->Id
. " into $id because of subject match.");
$self->TicketObj->MergeInto($id);
}
}

$id || return 1;

1;




> --
> It is all fun and games till flying monkeys attack
Ain't that the truth :-)

--
Howard Jones UK Datacentre NOC Team Virtustream, Inc. 227 Berwick Avenue
| Slough | Berkshire | SL1 4QT Office: +44 (0) 208.230.2105 | Fax: +44
(0) 208.230.2101 howard.jones [at] virtustream | www.virtustream.com


ruz at bestpractical

Jul 6, 2012, 5:17 AM

Post #3 of 3 (471 views)
Permalink
Re: Look for Existing ticket based on external RT Subject Tag [In reply to]

On Thu, Jul 5, 2012 at 6:37 PM, Joseph Moles <jbmoles [at] gmail> wrote:
> I'm running RT 4, and we have a external service provider that has their own
> RT system. When they create a ticket to us, their RT sends the notification
> to the email address associated with our RT. The problem is that their
> process is to send a notification on create, then send a message immediately
> after with the details. This generates two tickets in system. Has any one
> written or modified one of the scrips to look for an existing ticket with
> the subject tag from an external RT system, before creating a new ticket.
> Basically implement the similar logic that is used for internal subject tag,
> but basically same IF (Ticket with External Tag Exists) -> Update Ticket;
> Else Create new ticket.


You need to configure/code extracting other system's tag into CF or Attribute.
RT comes with a scrip to do it, but I don't know how suitable that is for your
case. RT extracts ticket id in one place in lib/RT/Interface/Email.pm function
ParseTicketId. This is the right place to implement any other association
based on anything you like. First argument of the function is Subject and
may be it's the only one, but you can always find all places where it's called
and add whole message object as the second argument.



> --
> It is all fun and games till flying monkeys attack



--
Best regards, Ruslan.

Request Tracker users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.