[rt-users] time-based Admincc: changes per queue?

Rick Russell rickr at rice.edu
Fri Apr 28 09:46:37 EDT 2006



brian mccabe wrote:

> Does anyone have a neat way of changing the AdminCC:'s
> on a queue dynamically, based on the day and time of
> day?

I can think of a few ways to do it. The AdminCC watcher list for a Queue
 can be modified by scrips. So you could have a script that does the
following.

-- Fires on an appropriate transaction ("correspond" and "comment" are
obvious choices)

-- Checks the current time and Queue watcher list.

-- Based on the time, changes the Queue watcher list.

Jesse Vincent's Business::Hours module would be most useful for this
purpose.

Example:

Custom condition:

  if (   ($self->TransactionObj->Type eq 'Create')
      || ($self->TransactionObj->Type eq 'Correspond')
      || ($self->TransactionObj->Type eq 'Comment')
         ## Add other transaction types as appropriate, depending on
         ## when & why you want to send notifications.
     )
  { return (1); }
  else
  { return (undef); }

Custom action prep:

  # Check to see if day group is currently on the Watcher list
  # but it's night so now we need to switch

  my $Queue = $self->$TicketObj->QueueObj;

  if (    ( # your custom time condition here
            # to determine that it's now night/off-hours
            # may be really complicated
          )
       &&
          ( $Queue->IsWatcher(Type => 'AdminCc',
                              Email => 'daygroup at blah.co.uk')
          )
     )
  { return (1); }
  else
  { return (undef); }

Custom action cleanup:

  my $Queue = $self->$TicketObj->QueueObj;

  $Queue->DeleteWatcher(Type => 'AdminCc',
                       Email => 'daygroup at blah.co.uk');

  $Queue->AddWatcher(Type => 'AdminCc',
                     Email => 'nightgroup at blah.co.uk');

  return(1);

end code!

Another way to do it would be to write a custom template that pumps in a
predefined "To" list based on the time of day, then use your custom
condition with the Notify Other Recipients action to send the
notifications. Forget about the whole AdminCc thing at all. In fact, now
that I think about it, that would probably be a whole lot easier than
dorking around with the Watcher lists for the Queue.

Yet a Third Way to do it: set up a custom notification e-mail list that
has its own timer that switches between the on-call service groups, and
abstract the whole thing out of RT. This would have the secondary
advantage that you could use the notification e-mail list for other
things, like sending non-RT-related notes to the current on-call service
group.

OK, I can only think of 3 ways to do it.

Rick R.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rickr.vcf
Type: text/x-vcard
Size: 182 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20060428/a6c13e5a/attachment.vcf>


More information about the rt-users mailing list