How to Monitor Your Symfony Application with Vigilmon

# php# symfony# monitoring# devops
How to Monitor Your Symfony Application with VigilmonVigilmon

How to Monitor Your Symfony Application with Vigilmon Symfony is one of the most widely...

How to Monitor Your Symfony Application with Vigilmon

Symfony is one of the most widely used PHP frameworks for building web applications, APIs, and enterprise systems. Whether you're running a small Symfony app or a large multi-bundle monolith, uptime monitoring is essential.

This guide shows you how to set up uptime and performance monitoring for your Symfony application using Vigilmon.


Why Monitor a Symfony Application?

Symfony apps can fail silently: a misconfigured bundle, a database timeout, or a failed queue worker may not produce an error page — they just degrade quietly. Monitoring catches these issues before your users do.

With Vigilmon, you can:

  • Monitor HTTP endpoints every 30 seconds
  • Alert via email, Slack, or PagerDuty when response time exceeds a threshold
  • Track Symfony's health check routes (if you use the symfony/health-check-bundle)
  • Publish a public status page for your users

Step 1: Expose a Health Check Endpoint

The fastest way is to add a lightweight health check controller:

<?php
// src/Controller/HealthController.php

namespace App\Controller;

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;

class HealthController
{
    #[Route('/health', name: 'health_check')]
    public function check(): JsonResponse
    {
        return new JsonResponse([
            'status' => 'ok',
            'timestamp' => time(),
        ]);
    }
}
Enter fullscreen mode Exit fullscreen mode

If you need database connectivity checks:

<?php
// src/Controller/HealthController.php

namespace App\Controller;

use Doctrine\DBAL\Connection;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;

class HealthController
{
    public function __construct(private Connection $db) {}

    #[Route('/health', name: 'health_check')]
    public function check(): JsonResponse
    {
        try {
            $this->db->executeQuery('SELECT 1');
            $dbStatus = 'ok';
        } catch (\Exception $e) {
            $dbStatus = 'error';
        }

        $status = $dbStatus === 'ok' ? 'ok' : 'degraded';
        $code = $status === 'ok' ? 200 : 503;

        return new JsonResponse([
            'status' => $status,
            'db' => $dbStatus,
            'timestamp' => time(),
        ], $code);
    }
}
Enter fullscreen mode Exit fullscreen mode

Step 2: Secure the Health Check

For public health endpoints, keep them lightweight and return minimal info:

# config/packages/security.yaml
security:
    access_control:
        - { path: ^/health, roles: PUBLIC_ACCESS }
Enter fullscreen mode Exit fullscreen mode

For internal metrics endpoints, restrict by IP or require an API key header.


Step 3: Add to Vigilmon

  1. Sign up at vigilmon.online
  2. Click Add Monitor
  3. Enter your health check URL: https://yourapp.example.com/health
  4. Set check interval: 1 minute (or 30 seconds on paid plans)
  5. Set alert threshold: notify if response time > 2000ms or HTTP status != 200
  6. Configure alert channels (email, Slack, webhook)

Step 4: Monitor Symfony Queue Workers

Symfony Messenger queue workers are critical but often unmonitored. Use a heartbeat monitor:

<?php
// src/MessageHandler/SomeMessageHandler.php

use Symfony\Contracts\HttpClient\HttpClientInterface;

class SomeMessageHandler
{
    public function __construct(private HttpClientInterface $http) {}

    public function __invoke(SomeMessage $message): void
    {
        // ... process message ...

        // Ping Vigilmon heartbeat to confirm worker is alive
        $this->http->request('GET', 'https://hb.vigilmon.online/your-heartbeat-id');
    }
}
Enter fullscreen mode Exit fullscreen mode

Step 5: Set Up a Public Status Page

Vigilmon lets you create a public status page at status.vigilmon.online/your-slug showing real-time uptime for all your monitors.

Share this with your users so they can self-check before submitting support tickets.


What to Monitor in a Symfony App

Endpoint What it checks
/health App is responding
/health (with DB check) App + database
/api/ping API layer
Queue worker heartbeat Background jobs running
Redis/Memcache cache Cache layer

Conclusion

Vigilmon gives your Symfony application production-grade monitoring without the complexity of self-hosted solutions. Set up your first monitor in under 5 minutes and get alerted before your users notice a problem.

Start monitoring your Symfony app — free tier available at vigilmon.online