Download the PHP package ejunker/laravel-queue-monitor without Composer
On this page you can find all versions of the php package ejunker/laravel-queue-monitor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ejunker/laravel-queue-monitor
More information about ejunker/laravel-queue-monitor
Files in ejunker/laravel-queue-monitor
Package laravel-queue-monitor
Short Description Laravel queue monitoring tools
License MIT
Informations about the package laravel-queue-monitor
Laravel queue monitor
This adds various tools to a project for monitoring its queue.
Laravel version
This branch and the 2.*
line of tags are for Laravel 5. For the Laravel 4
version see the laravel4 branch and the 1.*
line of tags.
If you are using Laravel 5.5 or later, and are using PHP 7.1 or later, and your queue is backed by Redis, you may instead consider using Laravel Horizon, which is an official tool and solves the same issue as this package.
Installation
Require it in your Laravel project:
composer require tremby/laravel-queue-monitor
If you're running Laravel 5.4 or below,
you have to register the service provider manually
in your config/app.php
file:
Use
Add a cron job which runs the queue:queuecheck
Artisan task for each queue you
want to monitor. A queue name can be passed as an argument, or the default queue
name is used if none is given. See ./artisan queue:queuecheck --help
for full
details.
Example cron job to check the default queue every 15 minutes:
*/15 * * * * php /home/forge/example.com/artisan queue:queuecheck
This task records in the application cache (for one day) that a check for this queue is pending, then pushes a job to this queue. This job changes that cached status to "OK", so if the job doesn't run for whatever reason the status will be left at "pending".
The status of all queue monitors can be checked by rendering one of the provided
status views. The markup of the provided views are Twitter
Bootstrap-friendly and if the status-page
view is
used Bootstrap is loaded from a CDN.
Other views available are queue-monitor::status-panel
, which is the .panel
element and its contents; and queue-monitor::status
, which is just the table
element. Either of these could be used to plug this monitor into a larger
monitoring panel. A panel_class
option can be passed, which defaults to
panel-default
.
There's also queue-monitor::status-json
, which renders JSON suitable for
machine consumption. This allows rendering options to be passed to the
underlying json_encode
and can be used like this:
In practice you might set the cron job to run every 15 minutes, and then
automate another job (such as with a remote health checker) to run a few minutes
later, consume the JSON, and ensure all queues have the ok
status. If any
don't, it could send an alert with a link to the HTML queue status view. It
could also check that the date at which the last check was queued is reasonable,
and so that the cron job has not stopped working.