[rt-users] General reminder emails

Jeremy Wilson jwilson at androsna.com
Wed Apr 8 09:44:04 EDT 2015


Sorry, I was not paying attention to the first part, but if I understand, you are looking for a way to remind users that they have tickets that they need to respond to?  I got some information a while back on RT statistics (or RTSTATS) which was a bunch of mysql statements written.  I was able to adopt them into emailing me a report of which tickets had not been responded to.    I place that script and cron job below.  The link that I can find now is http://requesttracker.wikia.com/wiki/RT3StatisticsPackage  It was written for RT3, so I am not sure if anything has changed.  This is also dependent on being able to email from your RT system.  I hope this helps.  The cron tab runs a script that runs the report.

First I will show the crontab that runs the job at 12:00PM Monday-Friday
********************************************************************
####### This cron will run a report from RT for tickets not responed to in last 24 hours
0 12 * * 1-5 /root/rtstats/stafftwentyfour.sh
*********************************************************************
Now I will show you the script stafftwentyfour.sh
**********************************************************************
#!/bin/sh
cd /root/rtstats
./twentyfourhour USER1
./twentyfourhour USER2
./twentyfourhour USER3
mail -s "Staff Reports For Request Tracker" jwilson at adomainname.com < /root/rtstats/twentyfour.txt
rm twentyfour.txt
./twentyfourhour USER1
./twentyfourhour USER2
./twentyfourhour USER3
./twentyfourhour USER4
./twentyfourhour USER5
./twentyfourhour USER6
mail -s "Staff Reports For Request Tracker" cnuckoles at adomainname.com < /root/rtstats/twentyfour.txt
rm twentyfour.txt
*********************************************************************************************
As you can see the script is made up into 3 parts
1. The first part is to run the script twentyfourhour "username"
This will run the script "twentyfourhour" for all users in the last 24 hours and creates a file twentyfour.txt with the results
of which ticket has not been responded to in the last 24 hours
2. The second part is to email twentyfour.txt in the body of the email to managers
3. The 3rd part is to remove twentyfour.txt for the next use. If you did not remove the file the it would keep appending the
results.


**************************************************************************************************
Now I will show you the script twentyfourhour
**************************************************************************************************
#!/usr/bin/perl
#
# $Id: rt3-stats,v 1.4 2004/02/12 06:28:28 carl Exp $
#
# rt3-staffreport
#
open(STDOUT, ">>twentyfour.txt");
use DBI;
my $database = "rtdb";
my $hostname = "";
my $port = '';
my $user = "rtuser";
my $password = "RTPASSWORD";
my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port";
my $dbh = DBI->connect($dsn,
$user,
$password,
{'RaiseError' => 1});
format STDOUT_TOP =
Tickets not responded to in last 24 hours for @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$userid
Id Status Created LastUpdated Queue Subject
=============================================================================
.
format STDOUT =
@<<<<<< @<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
@<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$ary[0],$ary[1], $ary[2], $ary[3], $ary[4], $ary[5]
~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$ary[5]
.
$userid = $ARGV[0];
$query = "select Tickets.id, Tickets.Status, Tickets.Created, Tickets.LastUpdated, Queues.Name, Tickets.Subject from
Tickets,Queues,Users where Tickets.Queue=Queues.id and Tickets.Owner=Users.id and Users.Name='$userid' and
Tickets.Status!='Resolved' and Tickets.Status!='Deleted' and Tickets.LastUpdated < DATE_SUB(now(), INTERVAL 1 DAY)";
$sth = $dbh->prepare($query) or die "Can't prepare queue query";
$rc = $sth->execute
or die "Can't execute statement: $DBI::errstr";
while (@ary = $sth->fetchrow_array) {
$ary[2] = `date -d 'GMT $ary[2]'`;
$ary[3] = `date -d 'GMT $ary[3]'`;
write;
}
$dbh->disconnect;
exit 0;
*************************************************************************************************


-----Original Message-----
From: rt-users [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf Of fleon
Sent: Wednesday, April 08, 2015 9:00 AM
To: rt-users at lists.bestpractical.com
Subject: Re: [rt-users] General reminder emails

Thank you, this seems to more or less do what i want. However, if i understand correctly, i must create a saved search for each one of my agents, since i don't see a way to create just one dashboard with opened or new tickets in a queue and the owner='myself' or something like that, so every user subscribed to that dashboard would get the email without needing to create one dashboard for each user.

Also, when consulting the README, i saw that there is a tool to send email digests. I will also try that option



--
View this message in context: http://requesttracker.8502.n7.nabble.com/General-reminder-emails-tp59838p59840.html
Sent from the Request Tracker - User mailing list archive at Nabble.com.
________________________________
 Jeremy Wilson
MIS Manager
540.217.4100 ext 257
Mobile: 540.333.1418
www.androsna.com <http://www.androsna.com>
[androsnortha]
The content of this e-mail (including any attachments) is strictly confidential and may be commercially sensitive. If you are not, or believe you may not be, the intended recipient, please advise the sender immediately by return e-mail, delete this e-mail and destroy any copies.



More information about the rt-users mailing list