Automatically opening stalled RT tickets

Hi Tom,

Please forgive the intrusion into your inbox, I noticed your post
dated
23rd June on the rt-users list archives and I am very interested in
your usage of rt-crontool to automatically re-open any stalled tickets
older than a certain age.

Would it be possible for you to share the command-line arguments you
have used for rt-crontool with the community?

Thanks in advance,

Matt

Hi Matt,

No problems - sorry for the delay getting back to you. I’ve CC’d the
list as well in case anyone else is curious.

We currently run something like this, once per day:

Search for tickets that have had no requestor correspondance for

more than 6 days,

open them and comment (this will notify ticket owner)

/var/www/rt.domain.com/rt/bin/rt-crontool
–search RT::Search::FromSQL
–search-arg “Queue = ‘Foo’ AND Status = ‘stalled’ AND Told <
‘6 days ago’ AND DependsOn IS NULL”
–action RT::Action::OpenTicketAndComment --action-arg “Auto-
opened due to being stalled for > 6 days.”

You’ll also notice the RT::Action::OpenTicketAndComment action which
is just a slightly modified RT::Action::AutoOpen so that we can also
place a comment in the ticket to show why it was re-opened. I’ve
attached our local/lib/RT/Action/OpenTicketAndComment.pm module if
you’re interested.

Caution: we added the ‘DependsOn IS NULL’ clause because this was re-
opening tickets that were stalled because they depended on another
ticket. However, through TicketSQL we are unable to query the status
of these depended-on tickets, so currently this won’t re-open stalled
tickets even if a depended-on ticket is resolved. I consider this a
bug with our process and plan to fix it by using a custom RT::Search
module to do a more fine-grained query, but haven’t had time.

Regards,
Tom

OpenTicketAndComment.pm (786 Bytes)

I tried this, put the PM in the correct folder, and ran the script. I
get the following error under RT3.8.0

[Tue Jul 22 00:37:05 2008] [crit]: Can’t call method “Message” on an
undefined value at /opt/rt3/bin/…/lib/RT/Action/AutoOpen.pm line 77.
(/opt/rt3/bin/…/lib/RT.pm:375)
Can’t call method “Message” on an undefined value at
/opt/rt3/bin/…/lib/RT/Action/AutoOpen.pm line 77.

Am I doing something wrong? Or is there a change in 3.8 that makes this
not work?

–RyanFrom: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Tom
Lanyon
Sent: Sunday, July 20, 2008 8:44 PM
To: Matthew Macdonald-Wallace
Cc: RT Users
Subject: Re: [rt-users] Automatically opening stalled RT tickets

Hi Tom,

Please forgive the intrusion into your inbox, I noticed your post
dated 23rd June on the rt-users list archives and I am very interested

in your usage of rt-crontool to automatically re-open any stalled
tickets older than a certain age.

Would it be possible for you to share the command-line arguments you
have used for rt-crontool with the community?

Thanks in advance,

Matt

Hi Matt,

No problems - sorry for the delay getting back to you. I’ve CC’d the
list as well in case anyone else is curious.

We currently run something like this, once per day:

Search for tickets that have had no requestor correspondance for more

than 6 days, ## open them and comment (this will notify ticket owner)
/var/www/rt.domain.com/rt/bin/rt-crontool
–search RT::Search::FromSQL
–search-arg “Queue = ‘Foo’ AND Status = ‘stalled’ AND Told <
‘6 days ago’ AND DependsOn IS NULL”
–action RT::Action::OpenTicketAndComment --action-arg “Auto-
opened due to being stalled for > 6 days.”

You’ll also notice the RT::Action::OpenTicketAndComment action which is
just a slightly modified RT::Action::AutoOpen so that we can also place
a comment in the ticket to show why it was re-opened. I’ve attached our
local/lib/RT/Action/OpenTicketAndComment.pm module if you’re interested.

Caution: we added the ‘DependsOn IS NULL’ clause because this was re-
opening tickets that were stalled because they depended on another
ticket. However, through TicketSQL we are unable to query the status of
these depended-on tickets, so currently this won’t re-open stalled
tickets even if a depended-on ticket is resolved. I consider this a bug
with our process and plan to fix it by using a custom RT::Search module
to do a more fine-grained query, but haven’t had time.

Regards,
Tom

I tried this, put the PM in the correct folder, and ran the script. I
get the following error under RT3.8.0

[Tue Jul 22 00:37:05 2008] [crit]: Can’t call method “Message” on an
undefined value at /opt/rt3/bin/…/lib/RT/Action/AutoOpen.pm line 77.
(/opt/rt3/bin/…/lib/RT.pm:375)
Can’t call method “Message” on an undefined value at
/opt/rt3/bin/…/lib/RT/Action/AutoOpen.pm line 77.

Am I doing something wrong? Or is there a change in 3.8 that makes
this
not work?

–Ryan

I haven’t tested it on 3.8 yet, only 3.6.

However, this error looks unrelated and occurs before my code even
runs. Your TransactionObj is undefined in
RT::Action::AutoOpen::Prepare(), I’m not sure what would cause that.

Regards,
Tom