<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=Ticket_Lifetime_Report</id>
	<title>Ticket Lifetime Report - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=Ticket_Lifetime_Report"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Ticket_Lifetime_Report&amp;action=history"/>
	<updated>2026-08-22T06:29:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Ticket_Lifetime_Report&amp;diff=26909&amp;oldid=prev</id>
		<title>Ghoti: github reference, reformatting</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Ticket_Lifetime_Report&amp;diff=26909&amp;oldid=prev"/>
		<updated>2019-04-18T15:20:07Z</updated>

		<summary type="html">&lt;p&gt;github reference, reformatting&lt;/p&gt;
&lt;a href=&quot;https://rt-wiki.bestpractical.com/index.php?title=Ticket_Lifetime_Report&amp;amp;diff=26909&amp;amp;oldid=26908&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Ghoti</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Ticket_Lifetime_Report&amp;diff=26908&amp;oldid=prev</id>
		<title>Ghoti: /* TODO */ formatting</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Ticket_Lifetime_Report&amp;diff=26908&amp;oldid=prev"/>
		<updated>2019-04-18T14:48:38Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;TODO: &lt;/span&gt; formatting&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:48, 18 April 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l103&quot;&gt;Line 103:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 103:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==TODO ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==TODO ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This work is far from complete. I&#039;ve got a few items on my TODO list:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Add a break out of ticket lifetime by owner.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Add email support.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Make this available via the web interface with graphing goodness.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This work is far from complete. I&#039;ve got a few items on my TODO list:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#Add a break out of ticket lifetime by owner.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#Add email support.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#Make this available via the web interface with graphing goodness.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Warranty==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Warranty==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This script is provided as-is with no implicit or explicit gaurantee that it will work or won&amp;#039;t break your implementation; caveat emptor. It&amp;#039;s all in the spirit of giving back to the community. It&amp;#039;s free as in beer. I&amp;#039;m a big fan of pale ales...&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This script is provided as-is with no implicit or explicit gaurantee that it will work or won&amp;#039;t break your implementation; caveat emptor. It&amp;#039;s all in the spirit of giving back to the community. It&amp;#039;s free as in beer. I&amp;#039;m a big fan of pale ales...&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ghoti</name></author>
	</entry>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=Ticket_Lifetime_Report&amp;diff=3853&amp;oldid=prev</id>
		<title>Admin: 4 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=Ticket_Lifetime_Report&amp;diff=3853&amp;oldid=prev"/>
		<updated>2016-04-06T20:39:28Z</updated>

		<summary type="html">&lt;p&gt;4 revisions imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Advanced Reporting==&lt;br /&gt;
I&amp;#039;ve been piloting RT for a few months and have been very happy with the system&amp;#039;s operation and reporting capabilities. Recently, though, I&amp;#039;ve had the need to get some advanced reports from the system such as how well my team has been performing with respect to internal service levels. Specifically, I need to determine how long tickets &amp;quot;lived&amp;quot; from creation to resolution so I can gauge how effective the team is at completing requests. To do this, I need to find the age of resolved tickets and generate a histogram. I rolled my own script using RT&amp;#039;s modules so that, hopefully, it&amp;#039;s portable across RT versions.&lt;br /&gt;
==rtTicketLifetime.pl==&lt;br /&gt;
 #!/usr/bin/perl&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # rtTicketLifetime.pl - query RT and generate a report on the lifetime of resolved tickets&lt;br /&gt;
 # Author: Ryan Frantz ryanfrantz [at] informed-llc [dot] com&lt;br /&gt;
 #&lt;br /&gt;
 &lt;br /&gt;
 use strict;&lt;br /&gt;
 use warnings;&lt;br /&gt;
 &lt;br /&gt;
 use lib &amp;quot;/usr/local/rt/lib&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 use RT;&lt;br /&gt;
 use RT::User;&lt;br /&gt;
 use RT::Interface::CLI qw( CleanEnv GetCurrentUser );   # I guess these aren&amp;#039;t exported?&lt;br /&gt;
 &lt;br /&gt;
 use Date::Calc qw( Delta_DHMS );&lt;br /&gt;
 &lt;br /&gt;
 # TODO:&lt;br /&gt;
 # 1. add a break out of ticket lifetime by owner&lt;br /&gt;
 # 2. add email support&lt;br /&gt;
 # 3. make this available via the web interface with graphing goodness&lt;br /&gt;
 &lt;br /&gt;
 ## start me up!&lt;br /&gt;
 &lt;br /&gt;
 # set the stage...&lt;br /&gt;
 CleanEnv();&lt;br /&gt;
 RT::LoadConfig;&lt;br /&gt;
 RT::Init;&lt;br /&gt;
 &lt;br /&gt;
 my $currentUser = GetCurrentUser();&lt;br /&gt;
 my $tickets = RT::Tickets-&amp;gt;new( $currentUser );&lt;br /&gt;
 #my $query = qq[ Created &amp;gt; &amp;#039;2011-04-01&amp;#039; AND Queue = &amp;#039;Support Desk&amp;#039; AND Status = &amp;#039;resolved&amp;#039; ];&lt;br /&gt;
 my $query = qq[ Created &amp;gt; &amp;#039;3 months ago&amp;#039; AND Queue = &amp;#039;Support Desk&amp;#039; AND Status = &amp;#039;resolved&amp;#039; ];&lt;br /&gt;
 &lt;br /&gt;
 my $validQuery = $tickets-&amp;gt;FromSQL( $query );&lt;br /&gt;
 #print &amp;quot;VALID QUERY!\n&amp;quot; if $validQuery;&lt;br /&gt;
 &lt;br /&gt;
 my $binThreshold = &amp;#039;7&amp;#039;; # 7 days, trust me...&lt;br /&gt;
 my @histogramData;      # prep dat&lt;br /&gt;
 # initialize the bins, in case there are any that don&amp;#039;t get incremented later&lt;br /&gt;
 # we&amp;#039;ll use the array&amp;#039;s indices to define the time period in which the ticket lived (i.e. $histogramData[0] is for tickets resolved in &amp;lt; 1 day)&lt;br /&gt;
 foreach my $day ( 0..$binThreshold ) {&lt;br /&gt;
         $histogramData[ $day ] = &amp;#039;0&amp;#039;;&lt;br /&gt;
 }&lt;br /&gt;
 while ( my $ticket = $tickets-&amp;gt;Next() ) {&lt;br /&gt;
         #my $owner = $ticket-&amp;gt;OwnerObj; # we&amp;#039;re not using this yet...&lt;br /&gt;
 &lt;br /&gt;
         # CreatedObj is available via RT::Record&lt;br /&gt;
         my $dateCreated = $ticket-&amp;gt;CreatedObj-&amp;gt;Get( Timezone =&amp;gt; &amp;#039;server&amp;#039; );&lt;br /&gt;
         my $dateResolved = $ticket-&amp;gt;ResolvedObj-&amp;gt;Get( Timezone =&amp;gt; &amp;#039;server&amp;#039; );&lt;br /&gt;
         my @dateCreated = split( /-|:| /, $dateCreated );&lt;br /&gt;
         my @dateResolved = split( /-|:| /, $dateResolved );&lt;br /&gt;
         my ( $deltaDays, $deltaHours, $deltaMinutes, $deltaSeconds ) = Delta_DHMS( @dateCreated, @dateResolved );&lt;br /&gt;
 &lt;br /&gt;
         # increment the bins; if the value is above the bin threshold, simply lump it into a &amp;quot;more&amp;quot; bin ( $binThreshold )&lt;br /&gt;
         if ( $deltaDays &amp;gt; $binThreshold ) {&lt;br /&gt;
                 #print &amp;quot;DEBUG: $deltaDays &amp;gt; $binThreshold\n&amp;quot;;&lt;br /&gt;
                 $histogramData[ $binThreshold ]++;&lt;br /&gt;
         } else {&lt;br /&gt;
                 #print &amp;quot;DEBUG: $deltaDays &amp;lt;= $binThreshold\n&amp;quot;;&lt;br /&gt;
                 $histogramData[ $deltaDays ]++;&lt;br /&gt;
         }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 print &amp;quot;\n&amp;quot; . localtime() . &amp;quot;\n&amp;quot;;&lt;br /&gt;
 print &amp;quot;\nQuery: $query\n&amp;quot;;&lt;br /&gt;
 print &amp;quot;\nFound &amp;quot; . $tickets-&amp;gt;CountAll . &amp;quot; tickets\n\n&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 my $day = &amp;#039;1&amp;#039;;&lt;br /&gt;
 foreach my $ticketsResolved ( @histogramData ) {&lt;br /&gt;
         if ( $day &amp;lt;= $binThreshold ) {&lt;br /&gt;
                 print $day - 1 . &amp;quot; &amp;lt; &amp;quot; . $day . &amp;quot;: &amp;quot; . $ticketsResolved . &amp;quot;\n&amp;quot;;&lt;br /&gt;
         } else {&lt;br /&gt;
                 print $day . &amp;quot;+ : &amp;quot; . $ticketsResolved . &amp;quot;\n&amp;quot;;&lt;br /&gt;
         }&lt;br /&gt;
         $day++;&lt;br /&gt;
 }&lt;br /&gt;
 print &amp;quot;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
==Output==&lt;br /&gt;
When run, the script outputs its results to the screen as follows:&lt;br /&gt;
 Fri Jul  1 09:18:06 2011&lt;br /&gt;
 &lt;br /&gt;
 Query:  Created &amp;gt; &amp;#039;3 months ago&amp;#039; AND Queue = &amp;#039;Support Desk&amp;#039; AND Status = &amp;#039;resolved&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 Found 72 tickets&lt;br /&gt;
 &lt;br /&gt;
 0 &amp;lt; 1: 58&lt;br /&gt;
 1 &amp;lt; 2: 2&lt;br /&gt;
 2 &amp;lt; 3: 4&lt;br /&gt;
 3 &amp;lt; 4: 2&lt;br /&gt;
 4 &amp;lt; 5: 1&lt;br /&gt;
 5 &amp;lt; 6: 1&lt;br /&gt;
 6 &amp;lt; 7: 0&lt;br /&gt;
 8+ : 4&lt;br /&gt;
The output is simple but it clearly illustrates that the majority of my resolved tickets lived less than 24 hours (a very good thing!). Modify the $binThreshold and $query values to suit your own reporting needs.&lt;br /&gt;
&lt;br /&gt;
==TODO ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This work is far from complete. I&amp;#039;ve got a few items on my TODO list:&lt;br /&gt;
#Add a break out of ticket lifetime by owner.&lt;br /&gt;
#Add email support.&lt;br /&gt;
#Make this available via the web interface with graphing goodness.&lt;br /&gt;
==Warranty==&lt;br /&gt;
This script is provided as-is with no implicit or explicit gaurantee that it will work or won&amp;#039;t break your implementation; caveat emptor. It&amp;#039;s all in the spirit of giving back to the community. It&amp;#039;s free as in beer. I&amp;#039;m a big fan of pale ales...&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>