Using CLI to Report Tickets Matching a Date Criteria

We have been using RT for a while now but have been worried about upgrading to
version 3. I work for an ISP and we use RT for our ticketing system and also
have a monthly bonus that is based on the percentage of tickets closed each
month. For our current version we have a shell script that has the RT2 CLI
reporting which tickets were created after the 1st of the month and prior to
the first of the next month in certin queues and then report how many tickets
were
closed within that time period. It takes both values and divides them to come
up with the percentage resolved. I’m having probelms figuring out the syntax
in RT3’s CLI. I understand how it works but I can’t figure out the proper
expression. How would I declare creation dates and give it greater and lesser
than values? Is this possible? From reading some of the posts it seems like
this is not possible? Any kind of help would be much appriciated. We are
holding off on our version 3 upgrade until we can get some sort of solution in
place. It’s a bit ridiculous that we havn’t upgraded yet but I can only do it
when I’m told the time is right. Thanks for any information you guys can
provide. Take care.

We have been using RT for a while now but have been worried about upgrading to
version 3.
I work for an ISP and we use RT for our ticketing system and also
have a monthly bonus that is based on the percentage of tickets closed each
month. For our current version we have a shell script that has the RT2 CLI
reporting which tickets were created after the 1st of the month and prior to
the first of the next month in certin queues and then report how many tickets
were
closed within that time period. It takes both values and divides them to come
up with the percentage resolved. I’m having probelms figuring out the syntax
in RT3’s CLI.
[ …snip…]

Based on my past experiences with the CLI, I think that I have a
horrible way of achieving what you want! Here’s how I’d do it:

Basically, first use the CLI to put a list of every ticket, regardless
of when it was created, into an array e.g. TICKETS=“rt ls -i

Then write a loop (for ID in $TICKETS) and go though the array (rt show
-t ticket -f Created,Status $ID) You can manipulate the output of this
command to only get the dates and ticket statuses which you want.

You could probably save the last state of $ID to a file so that the next
time you ran the script, you started from where you left off.

I hope this makes sense.

  • Ken.

This email has passed through an IE Internet MailWall gateway
and has been screened for known viruses, potential viruses and
malicious code.

IE Internet.com MailWall (http://ieinternet.com/mailwall/)

Here is the start of a Perl script that will put you a little closer to
what you want:

#!/usr/bin/perl

use strict;
use warnings;
use lib qw(/opt/rt3/local/lib /opt/rt3/lib);

use RT;
RT::LoadConfig();
RT::Init();
use RT::Tickets;
use Date::Calc;

my @d1 = Date::Calc::Add_Delta_Days(Date::Calc::Today, -28);
my @d2 = Date::Calc::Today;

print “Monthly Request Tracker Report\n”;
print “Start date: $d1[0]-$d1[1]-1\n”;
print “End date: $d2[0]-$d2[1]-1\n\n”;

my $tickets = RT::Tickets->new( $RT::SystemUser );
$tickets->{‘allow_deleted_search’} = 0;
$tickets->IgnoreType();
$tickets->UnLimit();
$tickets->LimitQueue( VALUE => ‘My Queue’ );
$tickets->LimitCreated( OPERATOR => ‘>’, VALUE => $d1[0] . ‘-’ . $d1[1] . ‘-01’);
$tickets->LimitCreated( OPERATOR => ‘<’, VALUE => $d2[0] . ‘-’ . $d2[1] . ‘-01’);
my $total = $tickets->Count();On Tue, Dec 07, 2004 at 10:25:06AM -0600, geno@onshore.net wrote:

We have been using RT for a while now but have been worried about upgrading to
version 3. I work for an ISP and we use RT for our ticketing system and also
have a monthly bonus that is based on the percentage of tickets closed each
month. For our current version we have a shell script that has the RT2 CLI
reporting which tickets were created after the 1st of the month and prior to
the first of the next month in certin queues and then report how many tickets
were
closed within that time period. It takes both values and divides them to come
up with the percentage resolved. I’m having probelms figuring out the syntax
in RT3’s CLI. I understand how it works but I can’t figure out the proper
expression. How would I declare creation dates and give it greater and lesser
than values? Is this possible? From reading some of the posts it seems like
this is not possible? Any kind of help would be much appriciated. We are
holding off on our version 3 upgrade until we can get some sort of solution in
place. It’s a bit ridiculous that we havn’t upgraded yet but I can only do it
when I’m told the time is right. Thanks for any information you guys can
provide. Take care.


The rt-users Archives

Be sure to check out the RT wiki at http://wiki.bestpractical.com