[Bps-public-commit] RT-Extension-Nagios branch, master, updated. 5585766a4c651dd328574d8e7695953d8cbe85a9
? sunnavy
sunnavy at bestpractical.com
Tue Apr 5 10:09:36 EDT 2011
The branch, master has been updated
via 5585766a4c651dd328574d8e7695953d8cbe85a9 (commit)
via 1cb13059b88d1fd65a15464e776bed7eebe3d61a (commit)
from 2903c97b64ba2b242131ee3449948134aca02f86 (commit)
Summary of changes:
Changes | 5 +++++
lib/RT/Action/UpdateNagiosTickets.pm | 31 +++++++++++++++----------------
lib/RT/Extension/Nagios.pm | 7 ++++++-
3 files changed, 26 insertions(+), 17 deletions(-)
- Log -----------------------------------------------------------------
commit 1cb13059b88d1fd65a15464e776bed7eebe3d61a
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Apr 5 22:06:15 2011 +0800
we can customize resolved status now, also tweak tickets limit to use activestatus
diff --git a/lib/RT/Action/UpdateNagiosTickets.pm b/lib/RT/Action/UpdateNagiosTickets.pm
index 26fa7f7..5d996b6 100644
--- a/lib/RT/Action/UpdateNagiosTickets.pm
+++ b/lib/RT/Action/UpdateNagiosTickets.pm
@@ -42,17 +42,16 @@ subject with values $type, $category, $host, $problem_type and $problem_severity
. ( $problem_type ? "/$problem_type" : '' ),
OPERATOR => 'LIKE',
);
- $tickets->LimitStatus(
- VALUE => 'new',
- OPERATOR => '=',
- ENTRYAGGREGATOR => 'or'
- );
- $tickets->LimitStatus(
- VALUE => 'open',
- OPERATOR => '=',
- ENTRYAGGREGATOR => 'or'
- );
- $tickets->LimitStatus( VALUE => 'stalled', OPERATOR => '=' );
+ my @active = RT::Queue->ActiveStatusArray();
+ for my $active (@active) {
+ $tickets->LimitStatus(
+ VALUE => $active,
+ OPERATOR => '=',
+ );
+ }
+
+ my $resolved = RT->Config->Get('NagiosResolvedStatus') || 'resolved';
+
if ( RT->Config->Get('NagiosMergeTickets') ) {
while ( my $ticket = $tickets->Next ) {
next if $ticket->id == $new_ticket_id;
@@ -65,7 +64,7 @@ subject with values $type, $category, $host, $problem_type and $problem_severity
}
if ( $type eq 'RECOVERY' ) {
- my ( $ret, $msg ) = $new_ticket->SetStatus('resolved');
+ my ( $ret, $msg ) = $new_ticket->SetStatus($resolved);
if ( !$ret ) {
$RT::Logger->error( 'failed to resolve ticket '
. $new_ticket->id
@@ -77,20 +76,20 @@ subject with values $type, $category, $host, $problem_type and $problem_severity
while ( my $ticket = $tickets->Next ) {
my ( $ret, $msg ) = $ticket->Comment(
Content => 'going to be resolved by ' . $new_ticket_id,
- Status => 'resolved',
- );
+ Status => $resolved,
+ );
if ( !$ret ) {
$RT::Logger->error(
'failed to comment ticket ' . $ticket->id . ": $msg" );
}
- ( $ret, $msg ) = $ticket->SetStatus('resolved');
+ ( $ret, $msg ) = $ticket->SetStatus($resolved);
if ( !$ret ) {
$RT::Logger->error(
'failed to resolve ticket ' . $ticket->id . ": $msg" );
}
}
- my ( $ret, $msg ) = $new_ticket->SetStatus('resolved');
+ my ( $ret, $msg ) = $new_ticket->SetStatus($resolved);
if ( !$ret ) {
$RT::Logger->error(
'failed to resolve ticket ' . $new_ticket->id . ":$msg" );
diff --git a/lib/RT/Extension/Nagios.pm b/lib/RT/Extension/Nagios.pm
index 5afa49b..3a45a5c 100644
--- a/lib/RT/Extension/Nagios.pm
+++ b/lib/RT/Extension/Nagios.pm
@@ -60,6 +60,11 @@ in etc/RT_SiteConfig.pm like this:
Set($NagiosSearchAllQueues, 1); # true
Set($NagiosMergeTickets, 0); # false
+by default, tickets will be resolved with status C<resolved>, you can
+customize this via config item C<NagiosResolvedStatus>, e.g.
+
+ Set($NagiosResolvedStatus, "recovered");
+
=head1 AUTHOR
sunnavy C<< <sunnavy at bestpractical.com> >>
commit 5585766a4c651dd328574d8e7695953d8cbe85a9
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Apr 5 22:09:25 2011 +0800
release 0.05
diff --git a/Changes b/Changes
index 080af4d..54d2f74 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+0.05 Tue Apr 5 22:06:24 CST 2011
+
+ customize resolved status via config NagiosResolvedStatus
+ use the actual active status instead of new/open/stalled
+
0.04 Mon Apr 4 13:16:58 CST 2011
make it work with RT 4.0
diff --git a/lib/RT/Extension/Nagios.pm b/lib/RT/Extension/Nagios.pm
index 3a45a5c..baf3c7d 100644
--- a/lib/RT/Extension/Nagios.pm
+++ b/lib/RT/Extension/Nagios.pm
@@ -9,7 +9,7 @@ RT::Extension::Nagios - Merge and resolve Nagios tickets
=cut
-our $VERSION = '0.04';
+our $VERSION = '0.05';
1;
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list