diff options
author | Perl Tidy <perltidy@bugzilla.org> | 2018-12-05 21:38:52 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-12-05 23:49:08 +0100 |
commit | 8ec8da0491ad89604700b3e29a227966f6d84ba1 (patch) | |
tree | 9d270f173330ca19700e0ba9f2ee931300646de1 /scripts/nagios_push_checker.pl | |
parent | a7bb5a65b71644d9efce5fed783ed545b9336548 (diff) | |
download | bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.gz bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.xz |
no bug - reformat all the code using the new perltidy rules
Diffstat (limited to 'scripts/nagios_push_checker.pl')
-rwxr-xr-x | scripts/nagios_push_checker.pl | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/scripts/nagios_push_checker.pl b/scripts/nagios_push_checker.pl index ef350c3e1..4ff43f0da 100755 --- a/scripts/nagios_push_checker.pl +++ b/scripts/nagios_push_checker.pl @@ -12,8 +12,6 @@ use warnings; use lib qw(. lib local/lib/perl5); - - use Bugzilla; use Bugzilla::Constants; use Bugzilla::Product; @@ -22,11 +20,7 @@ use Getopt::Long; Bugzilla->usage_mode(USAGE_MODE_CMDLINE); -my $config = { - connector => '', - warn => 5, - alarm => 10, -}; +my $config = {connector => '', warn => 5, alarm => 10,}; my $usage = <<EOF; DESCRIPTION @@ -46,39 +40,39 @@ EXAMPLES nagios_push_checker.pl --connector TCL --warn 25 --alarm 50 EOF -die($usage) unless GetOptions( - 'connector=s' => \$config->{connector}, - 'warn=i' => \$config->{warn}, - 'alarm=i' => \$config->{alarm}, - 'help|?' => \$config->{help}, -); +die($usage) + unless GetOptions( + 'connector=s' => \$config->{connector}, + 'warn=i' => \$config->{warn}, + 'alarm=i' => \$config->{alarm}, + 'help|?' => \$config->{help}, + ); die $usage if $config->{help} || !$config->{connector}; # -use constant NAGIOS_OK => 0; -use constant NAGIOS_WARNING => 1; -use constant NAGIOS_CRITICAL => 2; -use constant NAGIOS_NAMES => [qw( OK WARNING CRITICAL )]; +use constant NAGIOS_OK => 0; +use constant NAGIOS_WARNING => 1; +use constant NAGIOS_CRITICAL => 2; +use constant NAGIOS_NAMES => [qw( OK WARNING CRITICAL )]; my $dbh = Bugzilla->switch_to_shadow_db; -my ($count) = $dbh->selectrow_array( - "SELECT COUNT(*) FROM push_backlog WHERE connector=?", - undef, - $config->{connector}, -); +my ($count) + = $dbh->selectrow_array("SELECT COUNT(*) FROM push_backlog WHERE connector=?", + undef, $config->{connector},); my $state; if ($count >= $config->{alarm}) { - $state = NAGIOS_CRITICAL; -} elsif ($count >= $config->{warn}) { - $state = NAGIOS_WARNING; -} else { - $state = NAGIOS_OK; + $state = NAGIOS_CRITICAL; +} +elsif ($count >= $config->{warn}) { + $state = NAGIOS_WARNING; +} +else { + $state = NAGIOS_OK; } -print "push ", NAGIOS_NAMES->[$state], ": ", $count, " ", - "push.", $config->{connector}, " message", - ($count == 1 ? '' : 's'), " in backlog\n"; +print "push ", NAGIOS_NAMES->[$state], ": ", $count, " ", "push.", + $config->{connector}, " message", ($count == 1 ? '' : 's'), " in backlog\n"; exit $state; |