[rt-users] rt-crontool - "increase" the value of a CF.

Bart bart at pleh.info
Wed Nov 23 11:25:01 EST 2011


Before I start with the actual question I'll explain what I'm trying to
achieve first, just in case someone has a better idea for achieving it ;)

As you know the SLA plugin does it's job quite well but what if you'd want
to know exactly how long something was at a supplier or how long a customer
left you waiting for your reports?
It's quite difficult to find this information, and in our case we use
Business Objects to datamine RT's database and it's quite complicated
within BO to calculate these values (and taking into account the actual SLA
service windows + holidays).

Because of that we decided that we needed to solve this within RT, but how?

Below a list of our status types:

   - New
   - Open
   - Parked
   - At_supplier
   - At_requestor
   - At_Internal_department

(roughly translated since we use Dutch names for this)

Our solution was to create a Custom Field for every active/initial ticket
status type, this CF would have the soul purpose of simply showing the
amount of minutes a ticket had this status.
Thus the names of these CF's would look something like this: (these fields
will be hidden from users)

   - Time_New
   - Time_Open
   - Time_Parked
   - Time_At_supplier
   - Time_At_requestor
   - Time_At_Internal_department

Just to keep things clear I'm leaving these names as they are, this part up
to now is rather simple. The difficult part is to get a value inside those

We thought it would be good to create a cron job which will execute a bash
script (or perl, though I'm more familiar with bash) which will use
rt-crontool to search for all tickets with status X and then increase the
value of the CF Time_X by 5.
The cron job would run every 5 minutes, only during our service window and
within the bash script we'll add the intelligence for skipping the holidays.

So far so good.

I've then created a simple rt-crontool command to see if I could find a
ticket and if I could set a value when I found that ticket. This worked as
well, below the result:

/opt/rt4/bin/rt-crontool \
--search RT::Search::FromSQL \
--search-arg "status = 'open'" \
--action RT::Action::SetPriority --action-arg 3 \

So now for the question(s):

   - First a simple one, how do I set a value for a custom field?
   - And the more difficult one, how do I increase a value instead of
   replacing it? (adding + or something like that doesn't seem to work)

Hopefully this is possible with the rt-crontool, if not then I'd like to
hear your thoughts on how I'd be able to do the above in a different manner.

Thanks in advance for replying :-)

-- Bart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20111123/0d6aa0ca/attachment.htm>

More information about the rt-users mailing list