diff options
Diffstat (limited to 'extensions/Push/bin')
-rwxr-xr-x | extensions/Push/bin/bugzilla-pushd.pl | 54 | ||||
-rwxr-xr-x | extensions/Push/bin/nagios_push_checker.pl | 54 |
2 files changed, 108 insertions, 0 deletions
diff --git a/extensions/Push/bin/bugzilla-pushd.pl b/extensions/Push/bin/bugzilla-pushd.pl new file mode 100755 index 000000000..f048df157 --- /dev/null +++ b/extensions/Push/bin/bugzilla-pushd.pl @@ -0,0 +1,54 @@ +#!/usr/bin/perl + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +use strict; +use warnings; + +use FindBin '$RealBin'; +use lib "$RealBin/../../.."; +use lib "$RealBin/../../../lib"; +use lib "$RealBin/../lib"; + +BEGIN { + use Bugzilla; + Bugzilla->extensions; +} + +use Bugzilla::Extension::Push::Daemon; +Bugzilla::Extension::Push::Daemon->start(); + +=head1 NAME + +bugzilla-push.pl - Pushes changes queued by the Push extension to connectors. + +=head1 SYNOPSIS + + bugzilla-push.pl [OPTIONS] COMMAND + + OPTIONS: + -f Run in the foreground (don't detach) + -d Output a lot of debugging information + -p file Specify the file where bugzilla-push.pl should store its current + process id. Defaults to F<data/bugzilla-push.pl.pid>. + -n name What should this process call itself in the system log? + Defaults to the full path you used to invoke the script. + + COMMANDS: + start Starts a new bugzilla-push daemon if there isn't one running already + stop Stops a running bugzilla-push daemon + restart Stops a running bugzilla-push if one is running, and then + starts a new one. + check Report the current status of the daemon. + install On some *nix systems, this automatically installs and + configures bugzilla-push.pl as a system service so that it will + start every time the machine boots. + uninstall Removes the system service for bugzilla-push.pl. + help Display this usage info + + diff --git a/extensions/Push/bin/nagios_push_checker.pl b/extensions/Push/bin/nagios_push_checker.pl new file mode 100755 index 000000000..f022f584d --- /dev/null +++ b/extensions/Push/bin/nagios_push_checker.pl @@ -0,0 +1,54 @@ +#!/usr/bin/perl + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +use strict; +use warnings; + +use FindBin '$RealBin'; +use lib "$RealBin/../../.."; +use lib "$RealBin/../../../lib"; +use lib "$RealBin/../lib"; + +use Bugzilla; +use Bugzilla::Constants; + +Bugzilla->usage_mode(USAGE_MODE_CMDLINE); + +# Number of jobs required in the queue before we alert + +use constant WARN_COUNT => 500; +use constant ALARM_COUNT => 750; + +use constant NAGIOS_OK => 0; +use constant NAGIOS_WARNING => 1; +use constant NAGIOS_CRITICAL => 2; + +my $connector = shift + || die "Syntax: $0 connector\neg. $0 TCL\n"; +$connector = uc($connector); + +my $sql = <<EOF; + SELECT COUNT(*) + FROM push_backlog + WHERE connector = ? +EOF + +my $dbh = Bugzilla->switch_to_shadow_db; +my ($count) = @{ $dbh->selectcol_arrayref($sql, undef, $connector) }; + +if ($count < WARN_COUNT) { + print "push $connector OK: $count messages found.\n"; + exit NAGIOS_OK; +} elsif ($count < ALARM_COUNT) { + print "push $connector WARNING: $count messages found.\n"; + exit NAGIOS_WARNING; +} else { + print "push $connector CRITICAL: $count messages found.\n"; + exit NAGIOS_CRITICAL; +} |