[rt-users] integrate rt with monitor system

Howard Jones howard.jones at network-i.net
Mon Jan 23 08:42:24 EST 2006


Marco Avvisano wrote:
>
> Hi all,
> i'm new to RT..
> i'm tryng to integrate RT with my hobbit monitor system, so that when 
> an mail-allarm is generated form my monitor system,
> automatically a ticket is open on  RT.
> My question is, it's possible to configure RT so that if incoming more 
> equal emails from my monitor system is open only 1 ticket?
> How include the variable "time extimated to work" in open mail ticket?
Here's what we use to stop RT being swamped by Smokeping Alerts. I think 
someone has a similar thing for Nagios alerts on the Wiki that I used 
that as a starting point for this one - I don't write perl this way, and 
there's even a Nagios comment in there still :-)

It matches on subject line to a key ([SmokePing]), then looks for an 
existing ticket with the same subject and merges the new one into the 
old one.

Best Regards

Howard


Scrip for the General queue. Condition: OnCreate, Action: User Defined.

Custom Action is:

# 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;





More information about the rt-users mailing list