[rt-users] Example SLA crontool config
Craig Ringer
craig at 2ndquadrant.com
Wed Feb 27 22:45:33 EST 2013
Hi all
The RT::Extension::SLA docs don't include any example RT-crontool
commands for SLA alerting, so I thought I'd post what I'm using for
others' later benefit.
These are in /etc/cron.d/rt4site, to run as the OS user
"requesttracker4". I've created a user in the RT database with the gecos
("unix username") field set to "requesttracker4" that RT will run these
commands as.
# Escalate priority on non-stalled tickets as they approach due
*/5 * * * * requesttracker4 rt-crontool --search
RT::Search::FromSQL --search-arg "(Status='new' OR Status='open') AND
FinalPriority > 0 AND Due > 'Jan 1, 1970'" --action
RT::Action::EscalatePriority
# Every minute check to see if an SLA alert is needed. Send SLA alerts
at 45 minutes to due, 30 minutes to due, and every minute from 10
minutes to due until due time.
# This adds a comment (not customer visible) to the ticket using the
template 'SLA Due'. That comment is then sent as a notification to
subscribers according to RT's
# normal rules. The 'SLA Due' template can be a normal global email
template and can be overridden per-queue.
#
*/1 * * * * requesttracker4 rt-crontool --transaction last
--search RT::Search::FromSQL --search-arg "(Status='new' OR
Status='open') AND (Due > 'Jan 1, 1970') AND ((Due < '45 minutes' AND
Due >= '44 minutes') OR (Due < '30 minutes' AND Due >= '29 minutes') OR
(Due < '10 minutes' AND Due >= 'now'))" --action
RT::Action::RecordComment --template 'SLA Due'
# If we miss an SLA deadline, alert all participants with the 'SLA
Overdue' and keep yelling about it until they act on it.
*/5 * * * * requesttracker4 rt-crontool --transaction last
--search RT::Search::FromSQL --search-arg "(Due < 'now') AND (Due > 'Jan
1, 1970') AND (Status='new' OR Status='open')" --action
RT::Action::RecordComment --template 'SLA Overdue'
I'm also doing SLA alerting via SMS, but haven't packaged that into a
module yet.
It strikes me that it'd be really nice if rt-crontool could be driven
from a database table, so extensions could automatically add their
cronjobs and crontool could just be added to the system cron once during
RT system install.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
More information about the rt-users
mailing list