[rt-users] RT::Extension::Nagios and set TimeWorked Total of All Merged Tickets

Robert Gabriel ephemeric at gmail.com
Wed Feb 24 10:18:41 EST 2010


Hello all,

I'm using the RT::Extension::Nagios plugin and would like for
statistics purposes for my IT director
to have the total time worked calculated from all the previously
created problem merged tickets
when the recovery ticket is resolved.

What I can see so far: a ticket is created from 'PROBLEM' mail subject
and successive 'PROBLEM' tickets merge
previous tickets into them until we receive a 'RECOVERY' ticket and
that last (new) ticket ID is resolved.
What I think I need is to get the ticket history of the resolved
ticket ID and get the oldest transaction ID
from that and get the date created then calculate the difference
between the two dates using Date::Calc?

To demonstrate I have at least tried (but time is limited by
management) hence this mail.
I see one can use the rt shell or RT::Client::REST to get the required history.

rgabriel at orpheus:~/tmp$ rt show ticket/11113/history
# 24/24 (/total)

151090: Ticket created by robertg at anomaly.hugetelecom.co.za
151091: Outgoing email recorded by RT_System
151096: Ticket created by robertg at anomaly.hugetelecom.co.za
151097: Outgoing email recorded by RT_System
151098: Merged into ticket #11113 by RT_System

rgabriel at orpheus:~/tmp$ rt show ticket/11113/history/id/151124
# 24/24 (id/151124/total)

id: 151124
Ticket: 11113
TimeTaken: 0
Type: Status
Field: Status
OldValue: new
NewValue: resolved
Data:
Description: Status changed from 'new' to 'resolved' by RT_System
Content: This transaction appears to have no content
Creator: RT_System
Created: 2010-02-24 07:46:43
Attachments:

I suppose one could set TimeWorked from this.

I've tried using SetTimeWorkedAutomatically as a queue scrip but now I
see it is no good.
I'm learning how RT does things and it's not as expected.

I would like to know what is the most logical way of going about this?
I've tried looking at
/opt/rt3/share/html/Ticket/Elements/ShowHistory and adding some of that to
/opt/rt3/local/plugins/RT-Extension-Nagios/lib/RT/Action/UpdateNagiosTickets.pm
but I'm digging the hole deeper. I'm not going to investigate the Perl
internals of RT quite right now.
I could hack a dirty solution together using shell scripts etc. but I
want something clean and elegant.

Thanks.



More information about the rt-users mailing list