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.

rgabr...@orpheus:~/tmp$ rt show ticket/11113/history
# 24/24 (/total)

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

rgabr...@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.
_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: sa...@bestpractical.com

2010 RT Training Sessions!
San Francisco, CA, USA - Feb 22 & 23
Dublin, Ireland - Mar 15 & 16
Boston, MA, USA - April 5 & 6
Washington DC, USA - Oct 25 & 26

Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to