[rt-users] nag function?

David C. Troy dave at toad.net
Tue Aug 7 14:19:28 EDT 2001


All -- here is one I just now updated for RT2 use -- works just fine.

Two points:

  - This one is designed to send a message to EVERY support agent (we use
an alias called alert); the idea behind this is that it's a scoreboard of
who has the most tickets (their name appears in subject line) so they end
up feeling embarrassed (er, I mean motivated) to clean up their stuff.

  - It's pretty pathetic garbage.  If I had to write it today I'd use DBD,
etc -- I did it before then.  Don't feel like redoing it today.  While
this code works, it needs help.

For what it is, though, it works fine -- enjoy it!

Dave

--

#!/usr/bin/perl

use Mysql;

$mailprog = "/usr/sbin/sendmail -o -i -t";

open(MAIL, "|$mailprog");
print MAIL qq{To: yourstaff\@wherever.com
From: RT Ticketmaster <nobody\@wherever.com>
};

   $dbh = Mysql->Connect('yourdbserver', 'rt2', 'rt_user', 'yourrtpass');

   # List of *ALL* open tickets
   $query_string="SELECT u.Name name,count(t.id) ct
FROM Tickets t, Queues q, Users u
WHERE t.Queue = q.id
AND t.Owner = u.id
AND t.Status IN ('new','open')
GROUP BY u.Name
ORDER BY ct DESC";

   $sth=$dbh->Query($query_string) or warn
     "Query had some problem: $Mysql::db_errstr\n$query_string";
   while (($owner, $count)=$sth->FetchRow) {
      $allopen{$owner} = $count;
      $maxowner = $owner if ($count>$maxcount);
      $maxcount = $count if ($count>$maxcount);
      $total += $count;
   }
   $maxowner = "Nobody" if ($maxowner eq "");

   print MAIL "Subject: $total Open Tickets, $maxcount are $maxowner\'s\n\n";
   print MAIL "$total Open Support Tickets ($maxcount are $maxowner\'s)\n";
   print MAIL "$total Open Support Tickets:\n";
   foreach (sort {$allopen{$b} <=> $allopen{$a}} keys %allopen) {
      $owner = $_ || "none";
      printf MAIL ("   %-13s  %6d\n", $owner, $allopen{$_});
   }

close(MAIL);
exit(0);

---

=====================================================================
David C. Troy   [dave at toad.net]                   410-544-6193 Sales
ToadNet - Want to go fast?                        410-544-1329 FAX
570 Ritchie Highway, Severna Park, MD 21146-2925  www.toad.net

On Tue, 7 Aug 2001, Steve Poirier wrote:

> Are you talking about a script you put in the crontab and simply email to to
> users with open tickets once a day or a button in the RT interface.
>
> Because tommorow i began writing a script that will be in the crontab and
> will email to owner of tickets that are older than 1 day. I'll finish it
> probably tonight when i'll have some time.
> __
> Steve Poirier
> Project manager
> Inet-Technologies inc.
>
>
> ----- Original Message -----
> From: "Taylor, Bryant" <btaylor at virata.com>
> To: "'matthew zeier'" <matthew.zeier at thirdcoast.net>;
> <rt-users at lists.fsck.com>
> Sent: Tuesday, August 07, 2001 1:45 PM
> Subject: RE: [rt-users] nag function?
>
>
> > Ah man, that would be a great add-on. My manager just asked me about
> that.!!
> >
> >
> > -----Original Message-----
> > From: matthew zeier [mailto:matthew.zeier at thirdcoast.net]
> > Sent: Tuesday, August 07, 2001 10:31 AM
> > To: rt-users at lists.fsck.com
> > Subject: [rt-users] nag function?
> >
> >
> >
> > Has someone already put together a nag function, something to send email
> to
> > folks reminding them of their open issues?
> >
> > - mz
> >
> > --
> > matthew zeier - "In mathematics you don't understand things.  You just
> > get used to them." - John von Newmann
> >
> >
> > _______________________________________________
> > rt-users mailing list
> > rt-users at lists.fsck.com
> > http://lists.fsck.com/mailman/listinfo/rt-users
> >
> > _______________________________________________
> > rt-users mailing list
> > rt-users at lists.fsck.com
> > http://lists.fsck.com/mailman/listinfo/rt-users
> >
>
>
> _______________________________________________
> rt-users mailing list
> rt-users at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-users
>





More information about the rt-users mailing list