RT3BatchStats

From Request Tracker Wiki
Jump to navigation Jump to search

rt3-batch-stats - Command Line or batch statistics.

http://www.stagecraft.cx/software/rt3-batch-stats-0.1.tar.gz

Has the following files;

  • rt3-stats
Usage: rt3-stats <queue name>|All [<days>|<date from>] [<date to>]
       <days> is the number of days ago to report from.
        <date from> and <date to> are in the format yyyy-mm-dd

Produces;

    • Tickets created by date
    • Tickets created by day
    • Tickets resolved by person (includes "time worked total")
  • rt3-queue-stats
Usage: rt3-queue-stats <days>|<date from> [<date to>]
       <days> is the number of days ago to report from.
       <date from> and <date to> are in the format yyyy-mm-dd

Produces;

    • Tickets resolved by queue (includes elapsed time and time worked)
  • rt3-staffreport
rt3-staffreport <username>
    • Lists current new/open tickets for named user.

You will need to modify each script to insert your RT3 database name, userid and password.

The scripts should work with both RT2 and RT3. Note: For 3.4.1, v.0.1 had one change that needed to be made for the rt3-stats to work. Replace "Transactions.Ticket" with "Transactions.ObjectId" around line 234. To fix the mildly annoying Perl DBI warning in rt3-staffreport, add a line before the final "$dbh->disconnect;" that says "$sth->finish;" (around line 58 or so). This also fixes the same problem with rt3-stats (around line 261 is where the "$sth->finish;" should be inserted).

I am interested in other metrics people think would be useful. If you have any ideas please email at the address below.

Carl Makin (carl(at)xena.ipaustralia.gov.au)

  • Postgresql and 3.6.1 updates:
    • rt3-stats:
Line 61:
       $dayto = "NOW()";

Line 67:
       $dayfrom = "NOW() - INTERVAL '".$dayinterval." DAY')";

Lines 73 - 74:
      $dayfrom = "NOW() - INTERVAL '7 DAY'";
      $dayto = "NOW()";

Line 84:
      my $dsn = "DBI:Pg:database=$database;host=$hostname;port=$port";

Line 134:
$query ="select to_char(created, 'Month DD YYYY') as date, count(Id) from Tickets where $queuequery
         created>=$dayfrom and created <= $dayto group by date order by date";

Lines 158 - 164:
  %dow = (1 => 'Sunday',
       2 => 'Monday',
       3 => 'Tuesday',
       4 => 'Wednesday',
       5 => 'Thursday',
       6 => 'Friday',
       7 => 'Saturday');

Line 187:
$query ="select to_char(created, 'D') as date, count(Id) from Tickets where $queuequery created>=$dayfrom and
         created <= $dayto group by date order by date";

Line 230:
$query = "SELECT COUNT(Tickets.id) as resolvecount, Users.RealName, sum(Tickets.TimeWorked) FROM Transactions,
          Users, Tickets WHERE Tickets.id=Transactions.objectid AND Users.id = Transactions.Creator AND
          Transactions.Created >= $dayfrom and Transactions.Created <= $dayto AND $queuequery
          NewValue='resolved' GROUP BY Users.Realname ORDER BY resolvecount DESC;";