[rt-users] "nag"
Travis Campbell
travis.campbell at amd.com
Tue Aug 27 16:52:44 EDT 2002
On Tue, Aug 27, 2002 at 09:29:42PM +0300, Odhiambo Washington wrote:
> Anyone using "nag" in real life and willing to share his expolits??
>
I'm using modified versions of the nag script to do the following types of
things:
- nag if priority is greater than 75 and tickets are new or open
This makes sure people are doing the important things.
- nag if a ticket is owned by nobody and it's older than 24 hours
This ensures that any new/open tickets are given an owner by the person
watching the general queues for that week.
- nag if a ticket is owned by someone and it's been sitting in one of our
general queues for more than 24 hours
This makes sure tickets are being put into the proper queues once
assigned (in our case, proper means anywhere BUT the general queues ;-).
- nag if a ticket is owned by a specific user (cssadmin)
We've got some cronjobs that gate tickets into the corporate Rememdy
system via email. Local policy states that the person forwarding the
ticket into Rememdy becomes the liason between corporate IT and the user;
thus, the forwarder _should_ become the RT ticket owner. This nag notifies
us when a ticket is still owned by cssadmin. When found, we just reassign
as needed. I haven't had to deal with enough tickets to make it worthwhile
to reassign automatically.
We've also got stuff based on the nag script to deal with things like
crisis escalation and on-call notifications from our Crisis queue. It just
does successive pager notifications escalating up a set line of people until
it starts paging everyone on the team.
I've attached our simple priority whiner. It uses Mail::Mailer to create
and send the emails. YMMV, use at your own risk, etc.
Travis
--
Travis Campbell - Unix Systems Administrator = travis at mpdtxmail.amd.com
5900 E. Ben White Blvd, Austin, TX 78741 = travis.campbell at amd.com
TEL: (512) 602-1888 PAG: (512) 604-0341 = webmaster at mpdtxmail.amd.com
=============================================================================
"Does anything work as expected?" Yes. An axe through the CPU.
-------------- next part --------------
#!/opt/mpd/bin/perl -w
#
# $Header: /raid/cvsroot/rt-addons/nag,v 1.1 2001/10/11 01:59:54 jesse Exp $
# RT is (c) 1996-2001 Jesse Vincent <jesse at fsck.com>
use strict;
use Carp;
use lib "/opt/rt2/lib";
use lib "/opt/rt2/etc";
use RT::Interface::CLI qw(CleanEnv LoadConfig DBConnect
GetCurrentUser GetMessageContent);
#Clean out all the nasties from the environment
CleanEnv();
#Load etc/config.pm and drop privs
LoadConfig();
#Connect to the database and get RT::SystemUser and RT::Nobody loaded
DBConnect();
use RT::Date;
use RT::Queue;
use RT::Tickets;
use RT::Users;
use Mail::Mailer;
use Mail::Send;
my $now = new RT::Date($RT::SystemUser);
$now->SetToNow();
my $users = new RT::Users($RT::SystemUser);
RT::Users::LimitToPrivileged($users);
while (my $owner = $users->Next) {
my $tickets = new RT::Tickets($RT::SystemUser);
$tickets->LimitStatus(VALUE => 'open');
$tickets->LimitStatus(VALUE => 'new');
$tickets->LimitOwner(VALUE => $owner->Id);
$tickets->LimitPriority(VALUE => '74', OPERATOR => '>');
if ($tickets->Count > 0) {
my $message = $owner->Name . ",\n";
$message = $message . "You have " . $tickets->Count;
$message = $message . " open tickets:" . "\n\n";
while (my $ticket = $tickets->Next) {
$message .= $ticket->Id . ": " . $ticket->Subject . "\n";
$message .= "\tAge : " . $ticket->AgeAsString . "\n";
$message .= "\tPriority: " . $ticket->Priority . "\n\n";
}
$message .= "\n-- \nRT/" . $RT::rtname . "\n";
# Send the mail
my $msg = new Mail::Send Subject=>"Your open tickets", To=>$owner->Name;
$msg->to($owner->EmailAddress);
my $fh = $msg->open;
print $fh $message;
$fh->close;
}
}
$RT::Handle->Disconnect();
More information about the rt-users
mailing list