DEV Community

Vigilmon
Vigilmon

Posted on • Originally published at vigilmon.online

How to Monitor Your Elixir/Phoenix Application with Vigilmon (Complete Guide)

How to Monitor Your Elixir/Phoenix Application with Vigilmon (Complete Guide)

Elixir and Phoenix applications are known for their fault-tolerance and high concurrency. But even the most resilient BEAM-powered app can have downtime. This guide covers a complete monitoring strategy for Elixir/Phoenix using Vigilmon.

Why Phoenix Apps Need Dedicated Monitoring

Phoenix's supervisor trees and OTP process model handle many fault scenarios automatically — but they don't protect you from:

  • Infrastructure-level outages (load balancers, DNS, CDN failures)
  • External service dependencies (databases, third-party APIs)
  • SSL certificate expiry
  • Deployment regressions that survive supervisor restarts
  • Silent failures in background jobs (Oban, GenServer workers)

Vigilmon gives you external visibility that complements Phoenix's internal fault-tolerance.

Setting Up HTTP Uptime Monitoring

For a typical Phoenix app running on Fly.io, Render, or a VPS:

  1. Log in to vigilmon.online
  2. Click Add MonitorHTTP(S)
  3. Set your URL: https://yourapp.fly.dev or your custom domain
  4. Interval: 60 seconds (recommended for production)
  5. Set up email alerts for your engineering team

Health Check Endpoint in Phoenix

Add a lightweight health check to your Phoenix router:

# lib/your_app_web/router.ex
scope "/health", YourAppWeb do
  pipe_through :api
  get "/", HealthController, :check
end
Enter fullscreen mode Exit fullscreen mode
# lib/your_app_web/controllers/health_controller.ex
defmodule YourAppWeb.HealthController do
  use YourAppWeb, :controller

  def check(conn, _params) do
    # Check DB connection
    case YourApp.Repo.query("SELECT 1", []) do
      {:ok, _} ->
        json(conn, %{status: "ok", db: "connected"})
      {:error, _} ->
        conn
        |> put_status(503)
        |> json(%{status: "error", db: "disconnected"})
    end
  end
end
Enter fullscreen mode Exit fullscreen mode

Monitor /health in Vigilmon for a real-world health signal that tests your DB connection.

Monitoring Oban Background Jobs

Oban is the standard Phoenix background job library. Add a heartbeat job that pings Vigilmon:

# lib/your_app/workers/heartbeat_worker.ex
defmodule YourApp.Workers.HeartbeatWorker do
  use Oban.Worker, queue: :default, max_attempts: 1

  @vigilmon_heartbeat_url "https://push.vigilmon.online/YOUR_HEARTBEAT_KEY"

  @impl Oban.Worker
  def perform(_job) do
    # Ping Vigilmon heartbeat monitor
    :httpc.request(:get, {@vigilmon_heartbeat_url, []}, [], [])
    :ok
  end
end
Enter fullscreen mode Exit fullscreen mode

Schedule it every 5 minutes in your config:

# config/config.exs
config :your_app, Oban,
  plugins: [
    {Oban.Plugins.Cron,
     crontab: [
       {"*/5 * * * *", YourApp.Workers.HeartbeatWorker}
     ]}
  ]
Enter fullscreen mode Exit fullscreen mode

If Oban stops processing jobs, Vigilmon alerts you — even if the app itself is responding to HTTP requests.

SSL Certificate Monitoring

Phoenix apps on custom domains need SSL monitoring:

  1. In Vigilmon, add an SSL Monitor for your domain
  2. Set alert threshold: 14 days before expiry
  3. Set critical threshold: 7 days before expiry

This catches Let's Encrypt renewal failures before they cause production outages.

Multi-Region Checks for Phoenix on Fly.io

Fly.io deploys Phoenix apps in multiple regions. Configure Vigilmon to check from multiple locations:

  • Europe (Frankfurt/Amsterdam)
  • US East/West Coast
  • Asia Pacific

This ensures that even with Fly's anycast routing, every region is responding correctly.

Status Page Integration

For SaaS products built on Phoenix, add a public status page:

  1. In Vigilmon, go to Status PagesCreate New
  2. Add your key monitors (main app, API, WebSocket endpoint)
  3. Publish at status.yourapp.com
  4. Link it from your app's footer and docs

LiveView-Specific Monitoring

Phoenix LiveView uses long-lived WebSocket connections. Your HTTP uptime monitor won't catch LiveView-specific issues. Consider:

  • Monitor the WebSocket endpoint directly: wss://yourapp.com/live/websocket
  • Add a synthetic test user that triggers a LiveView mount (available in Vigilmon's advanced monitoring plans)

Alerting in Production

Recommended alert setup for Phoenix teams:

Alert Type Threshold Action
HTTP down 2 consecutive failures PagerDuty/Slack
SSL expiry 14 days Email
Health check fail 1 failure Slack
Oban heartbeat missed 10 min Slack + email

Summary

Vigilmon complements Phoenix's built-in fault-tolerance with external visibility. The key monitors for any Phoenix app:

  1. HTTP uptime — your main domain, 60s interval
  2. Health endpoint/health with DB check
  3. SSL certificate — 14-day warning
  4. Oban heartbeat — job processing liveness
  5. Status page — public transparency for users

Vigilmon — uptime monitoring, SSL alerts, and status pages for Elixir/Phoenix applications.

Top comments (0)