📦 laravel-schedule-monitor/ spatie
Monitor scheduled tasks in a Laravel app
Открыть на GitHub ↗обновлён 1мес назад
Звёзды
★ 995
Форки
74
За неделю
—
За месяц
—
Рост %
—
Язык
PHP
Установка и запуск
Installation
You can install the package via composer:
composer require spatie/laravel-schedule-monitor
If you need Laravel 8 support, you can install v2 of the package using composer require spatie/laravel-schedule-monitor:^2.
Preparing the database
You must publish and run migrations:
php artisan vendor:publish --provider="Spatie\ScheduleMonitor\ScheduleMonitorServiceProvider" --tag="schedule-monitor-migrations"
php artisan migrate
Publishing the config file
You can publish the config file with:
php artisan vendor:publish --provider="Spatie\ScheduleMonitor\ScheduleMonitorServiceProvider" --tag="schedule-monitor-config"
This is the contents of the published config file:
return [
/*
* The schedule monitor will log each start, finish and failure of all scheduled jobs.
* After a while the `monitored_scheduled_task_log_items` might become big.
* Here you can specify the amount of days log items should be kept.
*
* Use Laravel's pruning command to delete old `MonitoredScheduledTaskLogItem` models.
* More info: https://laravel.com/docs/11.x/eloquent#pruning-models
*/
'delete_log_items_older_than_days' => 30,
/*
* The date format used for all dates displayed on the output of commands
* provided by this package.
*/
'date_format' => 'Y-m-d H:i:s',
'models' => [
/*
* The model you want to use as a MonitoredScheduledTask model needs to extend the
* `Spatie\ScheduleMonitor\Models\MonitoredScheduledTask` Model.
*/
'monitored_scheduled_task' => Spatie\ScheduleMonitor\Models\MonitoredScheduledTask::class,
…
## Usage
To monitor your schedule you should first run `schedule-monitor:sync`. This command will take a look at your schedule and create an entry for each task in the `monitored_scheduled_tasks` table.
To view all monitored scheduled tasks, you can run `schedule-monitor:list`. This command will list all monitored scheduled tasks. It will show you when a scheduled task has last started, finished, or failed.
The package will write an entry to the `monitored_scheduled_task_log_items` table in the db each time a schedule tasks starts, end, fails or is skipped. Take a look at the contents of that table if you want to know when and how scheduled tasks did execute. The log items also hold other interesting metrics like memory usage, execution time, and more.
Из README репозитория · полный README на GitHub
Категории
Теги
laravelmonitorphpschedule