Request tracker poller script

I am the sysadmin who takes care RT at work. (More or less the whole IT team uses it for work related task/case management.)

I needed a solution to keep track what comes in and what leaves the system. There is a way to do that from the web UI. But I am more accustomed to the CLI so that was not what I wanted.

I already used rt the command line tool which talks the REST (like) API what RT uses.

RT::Client::REST client is here that basically takes care of the communication: it sends queries to the RT server parses the answers and makes it all available to the application as pure perl data structures.

The REST interface did not provide To or Cc values for transactions, so I added that (it took a while to find the right file :)

--- /usr/local/rt-3.8.2/share/rt3/html/REST/1.0/Forms/ticket/history    2009-01-28 09:10:02.000000000 +0100
+++ history     2011-06-07 03:05:00.457357787 +0200
@@ -122,18 +122,6 @@
    if (!%$fields || exists $fields->{lc 'TimeTaken'});
 push @data, [ Type    => $t->Type   ]
    if (!%$fields || exists $fields->{lc 'Type'});
+    if( defined $t->ContentObj ) {
+      push @data, [ To     => $t->ContentObj->GetHeader("To")   ]
+       if (!%$fields || exists $fields->{lc 'To'});
+      push @data, [ Cc     => $t->ContentObj->GetHeader("Cc")   ]
+       if (!%$fields || exists $fields->{lc 'Cc'});
+    }
+    else {
+      push @data, [ To     => ""   ]
+       if (!%$fields || exists $fields->{lc 'To'});
+      push @data, [ Cc     => ""   ]
+       if (!%$fields || exists $fields->{lc 'Cc'});
+    }
 push @data, [ Field    => $t->Field   ]
    if (!%$fields || exists $fields->{lc 'Field'});
 push @data, [ OldValue    => $t->OldValue   ]

I also include the RT client side poller script which runs on my machine. (We use http auth for now, so some changes can be necessary if using form based auth.)