Laravel powers millions of production applications — from SaaS products to e-commerce platforms to API backends. But Laravel's elegance doesn't prevent the most common production failures: a queue worker dying silently, a scheduled task missing its window, or a Livewire component endpoint returning 500 errors.
This guide covers everything you need to monitor a Laravel application effectively with Vigilmon.
The Laravel Monitoring Checklist
A complete Laravel monitoring setup covers:
- [ ] App URL availability (HTTPS, response code, keyword)
- [ ] Laravel health endpoint (
/upin Laravel 10+) - [ ] Queue health (workers processing jobs)
- [ ] Scheduled tasks (cron running on time)
- [ ] Horizon dashboard (if using Laravel Horizon)
- [ ] Critical API routes
Step 1: Use Laravel's Built-in Health Endpoint
Since Laravel 10, the framework ships with a /up health check endpoint at GET /up. This route runs the CheckDatabaseConnectionIsActive check and returns 200 if healthy.
Monitor it directly:
Monitor: GET https://yourapp.com/up
Type: HTTP(S)
Expected status: 200
Check interval: 1 minute
If you're on Laravel 9 or earlier, create a simple health route:
// routes/web.php
Route::get('/health', function () {
return response()->json([
'status' => 'ok',
'db' => DB::select('SELECT 1') ? 'connected' : 'disconnected',
'timestamp' => now()->toISOString(),
]);
})->name('health');
Step 2: Monitor Queue Workers with Heartbeat Checks
Queue workers dying silently is one of the most dangerous Laravel production issues. Jobs pile up, user-facing features break, but your app URL stays 200.
Solution: Heartbeat monitoring
In your most frequently queued job (or a dedicated heartbeat job), add a Vigilmon heartbeat ping:
// app/Jobs/QueueHeartbeat.php
class QueueHeartbeat implements ShouldQueue
{
public function handle(): void
{
Http::get('https://hb.vigilmon.online/YOUR_HEARTBEAT_ID');
}
}
Schedule it every 5 minutes:
// app/Console/Kernel.php
$schedule->job(new QueueHeartbeat)->everyFiveMinutes();
In Vigilmon, create a heartbeat monitor with a 10-minute grace window. If the ping doesn't arrive within 10 minutes, Vigilmon alerts you.
Step 3: Monitor Laravel Scheduler (Cron)
Laravel scheduler runs all your scheduled tasks via a single cron entry:
* * * * * cd /path/to/your/project && php artisan schedule:run >> /dev/null 2>&1
If this cron entry breaks (permission issue, wrong path, server restart), all scheduled tasks stop silently.
Create a sentinel command that pings Vigilmon:
// app/Console/Commands/SchedulerHeartbeat.php
class SchedulerHeartbeat extends Command
{
protected $signature = 'scheduler:heartbeat';
public function handle(): void
{
Http::get('https://hb.vigilmon.online/YOUR_SCHEDULER_HEARTBEAT_ID');
}
}
Schedule it every minute:
$schedule->command('scheduler:heartbeat')->everyMinute();
Now create a Vigilmon heartbeat monitor with a 2-minute deadline. If it misses two consecutive pings, you get alerted.
Step 4: Monitor Horizon
If you use Laravel Horizon, monitor the Horizon dashboard availability:
Monitor: GET https://yourapp.com/horizon
Type: HTTP(S)
Expected status: 200
Keyword check: "Horizon"
For Horizon's health API:
Monitor: GET https://yourapp.com/horizon/api/stats
Type: HTTP(S)
Expected status: 200
Keyword check: "jobsPerMinute"
You can also add a Horizon health check to Laravel's health endpoint:
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
Route::get('/health/horizon', function () {
$masters = app(MasterSupervisorRepository::class)->all();
$running = collect($masters)->filter(fn($m) => $m->status === 'running');
return response()->json([
'status' => $running->isNotEmpty() ? 'ok' : 'degraded',
'masters' => $running->count(),
], $running->isNotEmpty() ? 200 : 503);
});
Step 5: Monitor Critical API Routes
Monitor the API routes that your users depend on most:
Monitor: GET https://yourapp.com/api/v1/status
Type: HTTP(S)
Expected status: 200
Keyword check: "ok"
For authenticated routes, use Vigilmon's custom header support to include a pre-generated token:
Monitor: GET https://yourapp.com/api/v1/dashboard/summary
Headers: Authorization: Bearer YOUR_MONITORING_TOKEN
Expected status: 200
Create a dedicated read-only monitoring user in your users table for this purpose.
Step 6: Set Up Alerts
Configure Vigilmon to alert the right channels:
- Queue down: immediate Slack DM to backend engineer
- Scheduler missed: immediate email + Slack
- App URL down: PagerDuty escalation
- API route slow (>2s): Slack warning, no page
Vigilmon supports webhook alerts, so you can integrate with any alerting stack.
Recommended Monitor Set
| Monitor | URL/Type | Alert |
|---|---|---|
| App URL | GET / |
Down → immediate |
| Health endpoint | GET /up |
Down → immediate |
| Queue heartbeat | Heartbeat | 10-min miss → immediate |
| Scheduler heartbeat | Heartbeat | 2-min miss → immediate |
| Horizon dashboard | GET /horizon |
Down → immediate |
| Primary API route | GET /api/v1/status |
Down → immediate |
Start Monitoring in 5 Minutes
Vigilmon takes 5 minutes to set up — add your URLs, configure heartbeat monitors for your queue and scheduler, and connect your Slack or email for alerts.
Top comments (0)