spatie/laravel-schedule-monitor
Monitor Laravel scheduled tasks by logging each run’s start, finish, failure, or skip to the database. Use an Artisan list command to see execution history and spot issues. Optional Oh Dear sync alerts you when tasks fail or don’t run on time.
artisan schedule), making it a seamless fit for Laravel applications. It leverages Laravel’s Eloquent ORM, command bus, and queue systems, ensuring compatibility with Laravel’s architecture.MonitoredScheduledTask, MonitoredScheduledTaskLogItem), allowing customization for specific use cases (e.g., multitenancy, custom storage).monitorName(), graceTimeInMinutes(), storeOutputInDb()), enabling granular control over monitoring behavior without modifying core logic.app/Console/Kernel.php (e.g., adding schedule-monitor:sync to deployment scripts).PingOhDearJob). If the queue fails (e.g., misconfigured, overloaded), notifications may be delayed or lost. Mitigation: Monitor queue health and implement retries/alerts.delete_log_items_older_than_days and use Laravel’s pruning feature (as documented).PingOhDearJob is added to not_tenant_aware_jobs to avoid failures.graceTimeInMinutes values may lead to false positives/negatives in monitoring. Validate with schedule-monitor:verify.30 days sufficient, or does the team need custom pruning logic?spatie/laravel-multitenancy in use, and has PingOhDearJob been whitelisted?doNotMonitor() be used for non-critical tasks?schedule-monitor:sync integrated into CI/CD pipelines? How will sync conflicts (e.g., renamed tasks) be handled?spatie/laravel-multitenancy via config. For other multitenancy setups, manual tenant context handling may be required for PingOhDearJob.app/Console/Kernel.php to identify candidates for monitoring (exclude non-critical or high-frequency tasks if needed).schedule-monitor:sync and schedule-monitor:list output matches expectations.doNotMonitor() for tasks where logging is unnecessary (e.g., health checks).schedule-monitor:sync to deployment scripts (e.g., post-deploy hook).PingOhDearJob queue (e.g., Horizon, Laravel Telescope).Kernel.php.schedule-monitor:sync immediately after deployment.model:prune command).schedule-monitor:verify.PingOhDearJob.Kernel.php if schedules change. Consider a script to auto-sync these from a central config.schedule-monitor:list to diagnose missed/failed tasks.OH_DEAR_DEBUG_LOGGING for connectivity issues with Oh Dear.monitored_scheduled_task_log_items for execution details (e.g., memory usage, duration).graceTimeInMinutes or use doNotMonitor for non-critical tasks.delete_log_items_older_than_days.doNotMonitor() for non-critical tasks.How can I help you explore Laravel packages today?