Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Schedule Monitor

Laravel Schedule Monitor Laravel Package

spatie/laravel-schedule-monitor

Monitor Laravel scheduled tasks by logging starts, finishes, failures, and skips to a database table and viewing run history via an Artisan command. Optionally sync with Oh Dear to get alerts when tasks fail or don’t run on time.

View on GitHub
Deep Wiki
Context7

Monitor scheduled tasks in a Laravel app

Frequently asked questions about Laravel Schedule Monitor
How do I monitor a specific Laravel scheduled task without modifying its existing code?
Use the `monitorName()` method in your scheduled task’s `handle()` method. For example, `Schedule::command('command:name')->everyMinute()->monitorName('Process Payments');`. This automatically logs all executions without altering the task’s core logic.
What Laravel versions does spatie/laravel-schedule-monitor support?
The package supports Laravel 11+ by default. For Laravel 8, install version 2.x via `composer require spatie/laravel-schedule-monitor:^2`. Always check the [README](https://github.com/spatie/laravel-schedule-monitor) for version-specific notes before upgrading.
Does this package work with Laravel Forge or shared hosting environments?
Yes, but ensure your environment supports database migrations and Artisan commands. For shared hosting, verify queue workers (if using Oh Dear sync) are allowed, and check storage limits for log tables. Oh Dear’s API requires outbound HTTP access.
How can I view the history of my scheduled tasks?
Run `php artisan schedule-monitor:list` to display a table of all monitored tasks with their execution status (started, finished, failed, or skipped). Use `--failed` to filter only failed tasks or `--since=2024-01-01` to limit the time range.
What happens if my scheduled task fails? Will I get notified?
If configured, failures trigger alerts via Oh Dear (requires a subscription). For local debugging, check the `failed_at` column in the `monitored_scheduled_task_log_items` table or use `schedule-monitor:list --failed`. Custom alerts (e.g., Slack) can be added via webhooks or queue listeners.
How do I configure the grace period for a specific scheduled task?
Use the `graceTimeInMinutes()` method in your task’s `handle()`. For example, `Schedule::command('backup')->daily()->graceTimeInMinutes(15)` allows a 15-minute delay before Oh Dear flags a missed run. Adjust based on your task’s expected runtime and reliability.
Will this package slow down my Laravel application if I have hundreds of scheduled tasks?
The package adds minimal overhead during task execution. However, logging hundreds of tasks daily may grow the `monitored_scheduled_task_log_items` table. Use the `prune` command (`php artisan schedule-monitor:prune`) to retain logs for a set period (default: 30 days). Monitor table size with `DB::table('monitored_scheduled_task_log_items')->count()`.
Can I store the command output (stdout/stderr) in the database for debugging?
Yes, set `store_output_in_db` to `true` in the config file. This captures command output for each log entry, useful for debugging failures. Note this increases storage usage and may violate compliance policies—review your data retention requirements before enabling.
How do I sync my Laravel schedule with Oh Dear for external monitoring?
Publish the config file (`php artisan vendor:publish --tag=schedule-monitor-config`), then set your Oh Dear API token and monitor ID in the `oh_dear` section. Run `php artisan schedule-monitor:sync` to push your schedule to Oh Dear. Ensure your queue worker processes `PingOhDearJob` to avoid missed pings.
Are there alternatives to spatie/laravel-schedule-monitor for Laravel cron monitoring?
Yes, consider `spatie/laravel-cron-expression` for parsing cron syntax, `laravel-horizon` for queue monitoring, or third-party tools like Cronitor or UptimeRobot. For self-hosted solutions, integrate with Prometheus/Grafana using custom Laravel events. Evaluate based on your need for database logs, Oh Dear integration, or real-time dashboards.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony