RT

SendNagiosAlert – RT Integration

Description:

A script that you can use to send an alert to Nagios if a ticket is new or open in a particular RT queue(s).

Current Version

Last Release Date

May 27, 2009

Compatible With


Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Project Files
Project Notes

This script will only run if a ticket is created, a ticket's status is changed, or a ticket is moved to another queue. If one of these conditions is met, then it will looked at each queue defined in the scrip to see if there are any open or new Tickets in those queues. If there are no tickets in that queue, it will send an OK to the corresponding nagios service. If there are new or open tickets in that queue, it will send a CRITICAL to the corresponding nagios alert.

You must have Nagios already configured for this passive check, have send_nsca installed on the RT server, and the NSCA daemon running on the Nagios server.

Condition: User Defined

Custom Condition:

if ($self->TransactionObj->Type eq 'Create' ||
        $self->TransactionObj->Type eq 'Status' ||
        ($self->TransactionObj->Type eq 'Set' && $self->TransactionObj->Field eq "Queue"))  {
    return(1);
} else {
    return(undef);
}


Action: User Defined

Custom action preparation code:

1;


Custom action cleanup code:

{
  my %hosts = qw(
      Queue-Name1		definedNagiosHost1.domain.com
      Queue-Name2		definedNagiosHost2.domain.com
  );
  my $nscaBin = '/usr/local/nagios/libexec/send_nsca';
  my $nscaCfg = '/usr/local/nagios/etc/send_nsca.cfg';
  my $nscaHst = '';

  foreach my $QueueName (keys %hosts) {
    my $hostname = $hosts{$QueueName};
    my $TicketsObj = RT::Tickets->new($RT::SystemUser);
    $TicketsObj->LimitStatus(VALUE => 'open');
    $TicketsObj->LimitStatus(VALUE => 'new');
    $TicketsObj->LimitQueue(VALUE => $QueueName);  
    my $count = $TicketsObj->Count();
    if ($count eq '0') {
      system("printf "$hostnamet$QueueNamet0t$QueueName: No Alertsn" | $nscaBin -H $nscaHst -c $nscaCfg");
    } else {
      system("printf "$hostnamet$QueueNamet2t$QueueName: Open Alert(s)n" | $nscaBin -H $nscaHst -c $nscaCfg");
    }
  }
  1;
}

Reviews (0) Add a Review
Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
0 (0)
Favorites
0
Views
98,609