[rt-users] scrip best practice

Charles Johnson charles.johnson at accre.vanderbilt.edu
Wed Jun 23 08:55:21 EDT 2010


As a newbie to RT scrip development, I have a question about best  
practice. We are dropping our pager system in favor of AlarmPoint (now  
XMatters). I have developed a simple script which identifies the RT  
queue in which a ticket is created, and then calls the AlarmPoint  
message daemon (running on the same linux box as RT) with parameters  
extracted from the TicketObj. Everything works as expected. My  
question is about where in the web-interface presented by RT for  
building scrips is the best place for my "action". Does it belong in  
the "Custom Action Preparation" section, or the "Custom Action  
Cleanup" section?

Here is the very simple code:

Custom Condition:

if ($self->TransactionObj->Type eq 'Create' &&
    ($self->TicketObj->QueueObj->Name eq "ClusterSupport" ||
     $self->TicketObj->QueueObj->Name eq "StorageSupport"))
{
      return(1);
    } else {
      return(undef);
}

Custom Action preparation:

1;

Custom Cleanup:

{
   my $myQueueName = '';
   my $myQueue   = $self->TicketObj->QueueObj->Name;
   my $myId           = $self->TicketObj->EffectiveId;
   my $mySubject  = $self->TicketObj->Subject;

   if ($myQueue eq "ClusterSupport")
   {
      $myQueueName = "Cluster Group";
   } else {
      $myQueueName = "Storage Group";
   }

   my $binary = '/home/alarmpoint/alarmpointsystems/integrationagent/ 
bin/APClient.bin';
   system($binary, '--map-data', 'vanderbilt', $myQueueName,  
$mySubject, 'RT', "RT $myId");

   1;
}

So, given that this works just fine, does the code in "cleanup"  
actually belong in "preparation?"

TIA

Charles

--
Charles Johnson, Vanderbilt University
Advanced Computing Center for Research and Education
Office: 615-343-2776
Cell: 615-478-5743



More information about the rt-users mailing list