From 210e17650e672e6023f1cafaf5536cd75e2254d4 Mon Sep 17 00:00:00 2001 From: Ashish Vijayaram Date: Tue, 17 Dec 2013 13:25:21 +0800 Subject: Bug 951020: Nagios bug queue checks should also support paging for a specific component --- contrib/nagios_blocker_checker.pl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'contrib') diff --git a/contrib/nagios_blocker_checker.pl b/contrib/nagios_blocker_checker.pl index a67d72b6e..85bcc84de 100755 --- a/contrib/nagios_blocker_checker.pl +++ b/contrib/nagios_blocker_checker.pl @@ -24,9 +24,10 @@ Bugzilla->usage_mode(USAGE_MODE_CMDLINE); my $config = { - # filter by assignee or product + # filter by assignee, product or component assignee => '', product => '', + component => '', unassigned => 'nobody@mozilla.org', # severities severity => 'major,critical,blocker', @@ -42,12 +43,13 @@ my $config = { my $usage = < filter bugs by assignee --product filter bugs by product name + --component filter bugs by product's component name --unassigned set the unassigned user (default: $config->{unassigned}) SEVERITIES @@ -78,6 +80,7 @@ EOF die($usage) unless GetOptions( 'assignee=s' => \$config->{assignee}, 'product=s' => \$config->{product}, + 'component=s' => \$config->{component}, 'severity=s' => \$config->{severity}, 'major_alarm=i' => \$config->{major_alarm}, 'major_warn=i' => \$config->{major_warn}, @@ -92,6 +95,7 @@ die $usage if $config->{help} || !($config->{assignee} || $config->{product}) || ($config->{assignee} && $config->{product}) + || ($config->{component} && !$config->{product}) || !$config->{severity}; # @@ -107,6 +111,11 @@ my($where, @values, $severity); if ($config->{assignee}) { $where = 'bugs.assigned_to = ?'; push @values, Bugzilla::User->check({ name => $config->{assignee} })->id; +} elsif ($config->{component}) { + $where = 'bugs.product_id = ? AND bugs.component_id = ? AND bugs.assigned_to = ?'; + push @values, Bugzilla::Product->check({ name => $config->{product} })->id; + push @values, Bugzilla::Component->check({ name => $config->{component} })->id; + push @values, Bugzilla::User->check({ name => $config->{unassigned} })->id; } else { $where = 'bugs.product_id = ? AND bugs.assigned_to = ?'; push @values, Bugzilla::Product->check({ name => $config->{product} })->id; -- cgit v1.2.3-24-g4f1b