Monitor Laravel Scheduler

Learn how to monitor Laravel's task scheduler and Artisan commands with Haspulse.

Features

  • Native Laravel scheduler integration
  • Artisan command monitoring
  • Queue job monitoring
  • Works with Laravel Horizon

Code Examples

Kernel.php
// app/Console/Kernel.php
protected function schedule(Schedule $schedule)
{
    $schedule->command('backup:run')
        ->daily()
        ->at('03:00')
        ->pingBefore('https://haspulse.io/ping/YOUR_CHECK_ID/start')
        ->pingOnSuccess('https://haspulse.io/ping/YOUR_CHECK_ID')
        ->pingOnFailure('https://haspulse.io/ping/YOUR_CHECK_ID/fail');

    $schedule->command('queue:work --stop-when-empty')
        ->everyFiveMinutes()
        ->thenPing('https://haspulse.io/ping/QUEUE_CHECK_ID');
}
Artisan Command
// app/Console/Commands/ProcessReports.php
class ProcessReports extends Command
{
    protected $signature = 'reports:process';

    public function handle()
    {
        $checkUrl = 'https://haspulse.io/ping/' . config('services.haspulse.check_id');

        Http::get($checkUrl . '/start');

        try {
            $this->processReports();
            Http::get($checkUrl);
            return Command::SUCCESS;
        } catch (\Exception $e) {
            Http::get($checkUrl . '/fail');
            throw $e;
        }
    }
}

How It Works

  1. 1
    Create a check in Haspulse
    Set your expected schedule (e.g., every 5 minutes)
  2. 2
    Add the ping to your code
    Ping the unique URL when your job runs successfully
  3. 3
    Get alerted on failures
    If a ping doesn't arrive on time, we notify you

Related Integrations

Start monitoring in minutes

Create your first check and start receiving alerts when your scheduled jobs fail.

Get started free