Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Perl HTML Perl6 Other

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
etc
html
reports
Makefile
README
config

README

RTIR (RT for Incident Reponse) is a tool for tracking, responding to,
and investigating reported incidents.  Out of the box, it integrates
with RT3 (Also available from bestpractical.com)


Upgrading from RTIR 1.0.2:
-----

Follow instructions from previous "upgrading from" sections if they apply.

1) RTIR 1.0.3 changes the "SetRTIRState" custom scrip action in the
Incident Reports queue from previous versions.  AFTER Installing RTIR
1.0.3, alter the "SetRTIRState"'s custom action cleanup content to read

# ------------------------------------------------------------------- #
    my $State;
    my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
    $cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_State');
    unless ($cf->Id) { 
        return(1);
    }
    if ($self->TicketObj->Status eq 'new' or $self->TicketObj->Status eq 'open' or $self->TicketObj->Status eq 'stalled') {
      $State = 'new';
        my $parents = RT::Tickets->new($self->TransactionObj->CurrentUser);
        $parents->LimitHasMember($self->TicketObj->id);
        $parents->LimitQueue(VALUE => 'Incidents');
      if ($parents->First) {
        $State = 'open';
        }
    } elsif ($self->TicketObj->Status eq 'resolved') {
      $State = 'resolved';
    } elsif ($self->TicketObj->Status eq 'rejected') {
      $State = 'rejected';
    } else {
      return 0;
    }
    $self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => $State);
  return 1;
# ------------------------------------------------------------------- #

2) RTIR 1.0.3 changes the "SetRTIRState" custom scrip action in the
Investigations queue from previous versions.  AFTER Installing RTIR
1.0.3, alter the "SetRTIRState"'s custom action cleanup content to read

# ------------------------------------------------------------------- #
  my $State;
  my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
  $cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_State');
  unless ($cf->Id) { 
      return(1);
  }
  if ($self->TicketObj->Status eq 'open' or $self->TicketObj->Status eq 'new') {
      $State = 'open';
  } elsif ($self->TicketObj->Status eq 'resolved') {
      $State = 'resolved';
  } else {
      return 0;
  }
  $self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => $State);
  return 1;
# ------------------------------------------------------------------- #

3) RTIR 1.0.3 changes the "SetRTIRState" custom scrip action in the
Blocks queue from previous versions.  AFTER Installing RTIR
1.0.3, alter the "SetRTIRState"'s custom action cleanup content to read

# ------------------------------------------------------------------- #
my $State;
my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
$cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_State');
unless ($cf->Id) { 
    return(1);
}

if ($self->TicketObj->Status eq 'new') {
  $State = 'pending activation';
} elsif ($self->TicketObj->Status eq 'open') {
  $State = 'active';
} elsif ($self->TicketObj->Status eq 'stalled') {
  $State = 'pending removal';
} elsif ($self->TicketObj->Status eq 'resolved') {
  $State = 'removed';
} else {
  return 0;
}
$self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => $State);
return 1;
# ------------------------------------------------------------------- #

4) RTIR 1.0.3 changes the "SetRTIRState" custom scrip action in the
Incidents queue from previous versions.  AFTER Installing RTIR
1.0.3, alter the "SetRTIRState"'s custom action cleanup content to read

# ------------------------------------------------------------------- #
    my $State;
    my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
    $cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_State');
    unless ($cf->Id) { 
        return(1);
    }
    if ($self->TicketObj->Status eq 'new' ||
      $self->TicketObj->Status eq 'open' ||
      $self->TicketObj->Status eq 'stalled') {
      $State = 'open';
    } elsif ($self->TicketObj->Status eq 'resolved') {
      $State = 'resolved';
    } elsif ($self->TicketObj->Status eq 'rejected') {
      $State = 'abandoned';
    } else {
      return 0;
    }
    $self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => $State);
  return 1;
# ------------------------------------------------------------------- #

5) RTIR 1.0.3 changes the "SetDates" custom scrip action in the
Incident Reports queue from previous versions.  AFTER Installing RTIR
1.0.3, alter the "SetDates"'s custom action cleanup content to read

# ------------------------------------------------------------------- #
my $sla;
my $date = RT::Date->new($RT::SystemUser);
$date->SetToNow;
use Business::Hours;
my $bizhours = new Business::Hours;
if ($RT::BusinessHours) {
  $bizhours->business_hours(%$RT::BusinessHours);
}

if ($self->TicketObj->FirstCustomFieldValue('_RTIR_SLA')) {
  $sla = $self->TicketObj->FirstCustomFieldValue('_RTIR_SLA');
} elsif ($bizhours->first_after($date->Unix) != $date->Unix) {
  $sla = "Full service: out of hours";
} else {
  $sla = "Full service";
}

my $addminutes = $RT::SLA->{$sla};
if ($self->TicketObj->StartsObj->AsString eq "Not set") {
  my $starts = $bizhours->first_after($date->Unix);
  $date->Set(Format => 'unix', Value => $starts);
  $self->TicketObj->SetStarts($date->ISO);
  my $due = $bizhours->add_seconds($date->Unix, $addminutes * 60);
  $date->Set(Format => 'unix', Value => $due);
  $self->TicketObj->SetDue($date->ISO);
}
my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
$cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_SLA');
unless ($cf->Id) { 
    return(1);
}
$self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => $sla);
return 1;
# ------------------------------------------------------------------- #

6) RTIR 1.0.3 changes the "SetHowReported" custom scrip action in the
Incident Reports queue from previous versions.  AFTER Installing RTIR
1.0.3, alter the "SetHowReported"'s custom action cleanup content to read

# ------------------------------------------------------------------- #
my $cf = RT::CustomField->new($self->TransactionObj->CurrentUser);
$cf->LoadByNameAndQueue(Queue => $self->TicketObj->QueueObj->Id, Name => '_RTIR_HowReported');
unless ($cf->Id) { 
    return(1);
}
my $Values = $self->TicketObj->CustomFieldValues($cf->id);
if (!$Values->Next) {
  $self->TicketObj->AddCustomFieldValue(Field => $cf->id, Value => "Email");
}
  return 1;
# ------------------------------------------------------------------- #

7) RTIR 1.0.3 changes the "FixOwnership" custom scrip action in the
Incidents queue from previous versions.  AFTER Installing RTIR
1.0.3, alter the "FixOwnership"'s custom action cleanup content to read

# ------------------------------------------------------------------- #
{
  # change owner of child Incident Reports, Investigations, Blocks
  while (my $link = $self->TicketObj->Members->Next) {
    my $member= $link->BaseObj;
    if ( ($member->QueueObj->Name eq 'Incident Reports' ||
          $member->QueueObj->Name eq 'Investigations' ||
          $member->QueueObj->Name eq 'Blocks' ) &&
          $member->OwnerObj->id != $self->TransactionObj->NewValue) {
      my ($res, $msg); 
      my $user = new RT::CurrentUser($self->TransactionObj->CurrentUser);
      $user->Load($self->TransactionObj->Creator);
      my $t = new RT::Ticket($user);
      $t->Load($member->id);
      if ($self->TransactionObj->NewValue == $self->TransactionObj->Creator) {
        if ($self->TransactionObj->CurrentUser->id == $RT::Nobody->id) {
          ($res, $msg) = $t->Take();
        } else {
          ($res, $msg) = $t->Steal();
	}
      } else {
          ($res, $msg) = $t->SetOwner($self->TransactionObj->NewValue);
      }
      $RT::Logger->debug("FixOwnership Scrip: ".$msg)
    }
  }
  return 1;
}
# ------------------------------------------------------------------- #

8) RTIR 1.0.3 changes the "FixOwnership" custom scrip action in the
Incident Reports, Investigations, and Blocks queues from previous
versions.  AFTER Installing RTIR 1.0.3, alter the "FixOwnership"'s
custom action cleanup content in each of these queues to read

# ------------------------------------------------------------------- #
{
  # change owner of parent Incident(s)
  while (my $link = $self->TicketObj->MemberOf->Next) {
    my $incident= $link->TargetObj;
    if ( $incident->QueueObj->Name eq 'Incidents' &&
         $incident->OwnerObj->id != $self->TransactionObj->NewValue) {
      my ($res, $msg); 
      my $user = new RT::CurrentUser($self->TransactionObj->CurrentUser);
      $user->Load($self->TransactionObj->Creator);
      my $t = new RT::Ticket($user);
      $t->Load($incident->id);
      if ($self->TransactionObj->NewValue == $self->TransactionObj->Creator) {
          ($res, $msg) = $t->Steal();
      } else {
          ($res, $msg) = $t->SetOwner($self->TransactionObj->NewValue);
      }
      $RT::Logger->debug("FixOwnership Scrip: ".$msg)
    }
  }
  return 1;
}
# ------------------------------------------------------------------- #

Upgrading from RTIR 1.0.0:
--------------------------

RTIR now installs in RT's share/html directory rather than local/html,
making local modifications to RTIR easier.

1) IMPORTANT!  Back up any modifications that you've made to the
   /opt/rt3/local/html/RTIR directory.

2) Remove the old RTIR files:

   rm -r /opt/rt3/local/html/RTIR

3) Install RTIR by following the instructions below.


Installation instructions:
--------------------------

1) RTIR requires the Business::Hours module (version 0.05 or later)
   and the Net::Whois::RIPE module.  You should install them before 
   proceeding.

2) Install RT 3.0.  This version of RTIR requires at least RT
   3.0.4.

3) Once RT 3.0 appears to be happily installed, cd into the directory you
   unpacked RTIR into.

4) Edit RTIR's Makefile to point to your RT 3 instance.

5) make sure that mysql or pgsql's commandline tool is in your path.

6) Type "make install".

7) Add the following lines to your /opt/rt3/etc/RT_SiteConfig.pm file:

   # The RTIR config file

   $RTIR_CONFIG_FILE = "/opt/rt3/etc/RTIR_Config.pm";

   require $RTIR_CONFIG_FILE
     || die ("Couldn't load RTIR config file '$RTIR_CONFIG_FILE'\n$@");

8) If you are installindg RTIR for the first time, initialize the RTIR
   database by typing "make initdb".  Do not attempt to re-initialize
   the database if you are upgrading.

9) Stop and start your web server.


Configuring RTIR
----------------

1) Using the Configuration option in base RT, add the email address
   of the Network Operations Team (the people who will handle
   activating and removing Blocks) as AdminCC on the Blocks queue.

2) You may want to modify the email messages that are automatically
   sent on the creation of Investigations and Blocks.  The templates
   are "LaunchMessage" in the Investigations queue and "NewMessage" in
   the Blocks queue.

3) By default, RT3 has certain global Scrips.  You should look through
   them, and disable any that don't want.

4) Staff members who handle incidents should be added to the DutyTeam
   group.

5) You can override values in the RTIR_Config.pm in your
   RT_SiteConfig.pm file, following the "require" line explained
   above.


SETTING UP THE MAIL GATEWAY 
---------------------------

An alias for the Incident Reports  queue will need to be made in either 
your global mail aliases file (if you are using NIS) or locally on your
machine.
 
Add the following lines to /etc/aliases (or your local equivalent) :

rtir:         "|/opt/rt3/bin/rt-mailgate --queue 'Incident Reports' --action correspond --url http://localhost/"

You should substitute the URL for RT's web interface for "http://localhost/".


BUGS
----

To report a bug, send email to rtir-bugs@fsck.com.
Something went wrong with that request. Please try again.