tutorial

How to Monitor Livebook with Vigilmon

Livebook is Elixir's collaborative notebook platform — but notebook servers have unique failure modes like stalled kernel processes, hub connectivity issues, and long-running cell timeouts. Here's how to monitor Livebook deployments end-to-end with Vigilmon.

How to Monitor Livebook with Vigilmon

Livebook transforms Elixir development with collaborative, reproducible notebooks — interactive cells, live data visualization with Kino, and real-time collaboration over the BEAM. Organizations deploy Livebook as a persistent internal tool for data analysis, reporting, and runbooks. But a deployed Livebook server is a long-running service with its own failure modes: the server process can hang, hub connectivity can drop, notebook kernels can stall in expensive cells, and the underlying Phoenix socket can silently disconnect collaborators.

This tutorial sets up production monitoring for a self-hosted Livebook deployment:

  • HTTP uptime monitoring for the Livebook web interface
  • Heartbeat monitoring for long-running notebook jobs
  • Hub connectivity health checks
  • Slack alerts when the server becomes unreachable

Why Monitor Livebook?

| Signal | What it catches | |---|---| | Server availability | Phoenix process crash, OOM kill, port conflicts | | Hub connectivity | Livebook Teams hub disconnection, token expiry | | Notebook kernel health | Stalled cells blocking the runtime supervisor | | Response time | Overloaded server struggling under notebook load | | SSL certificate | Expired cert locking out all collaborators |

Livebook is often deployed as internal infrastructure and treated as "always on" — until the data team can't access their runbooks during an incident.


Step 1: Verify Livebook's Health Endpoint

Livebook ships with a built-in health endpoint at GET /health. It returns HTTP 200 when the server is running:

curl https://livebook.yourcompany.com/health
# => {"application":"livebook","version":"0.14.0"}

This is your primary Vigilmon target — no configuration required.


Step 2: Add Vigilmon Uptime Monitoring

  1. Log in to vigilmon.online and click Add Monitor.
  2. Set Type to HTTP / HTTPS.
  3. Enter your Livebook health URL: https://livebook.yourcompany.com/health.
  4. Set Check interval to 1 minute.
  5. Set Expected HTTP status to 200.
  6. Under Advanced, add a Response body contains check: "application":"livebook".
  7. Click Save.

Vigilmon now checks your Livebook server every minute and alerts on any outage.


Step 3: Monitor the Web Interface Directly

The /health endpoint checks the Elixir process, but you also want to confirm the web UI is reachable:

  1. Click Add MonitorHTTP / HTTPS.
  2. Enter the root URL: https://livebook.yourcompany.com/.
  3. Set Expected HTTP status to 200 or 302 (Livebook may redirect to login).
  4. Set Check interval to 2 minutes.
  5. Add a Response body contains check: Livebook (checks the HTML title).

This catches cases where the Phoenix router is broken but the health plug still responds.


Step 4: Add a Heartbeat for Scheduled Notebooks

Teams often run Livebook notebooks on a schedule — daily reports, data refreshes, automated runbooks. Use Vigilmon heartbeats to confirm these jobs complete successfully.

Add a heartbeat ping to the end of your scheduled notebook using Kino:

# In the final cell of your scheduled notebook

vigilmon_heartbeat_url = System.get_env("VIGILMON_HEARTBEAT_URL")

if vigilmon_heartbeat_url do
  Req.get!(vigilmon_heartbeat_url)
  IO.puts("Heartbeat sent to Vigilmon ✓")
end

Set the environment variable in your Livebook deployment:

# In your Livebook startup environment
export VIGILMON_HEARTBEAT_URL="https://vigilmon.online/api/heartbeat/YOUR_HEARTBEAT_ID"

Create the heartbeat in Vigilmon:

  1. Click Add MonitorCron / Heartbeat.
  2. Set the expected interval to match your notebook schedule (e.g., 24 hours).
  3. Set grace period to 1 hour.
  4. Copy the generated heartbeat URL into the VIGILMON_HEARTBEAT_URL environment variable.

If the notebook stalls mid-execution or fails to reach the final cell, the heartbeat is never sent and Vigilmon alerts you.


Step 5: Monitor Livebook Hub Connectivity

If you're using Livebook Teams, monitor hub connectivity with a dedicated heartbeat GenServer you can attach via a persistent notebook:

# A long-running notebook cell that monitors hub health

defmodule LivebookHubMonitor do
  use GenServer

  @check_interval :timer.minutes(5)
  @heartbeat_url System.get_env("VIGILMON_HEARTBEAT_URL")

  def start_link(_), do: GenServer.start_link(__MODULE__, nil, name: __MODULE__)

  def init(_) do
    schedule()
    {:ok, nil}
  end

  def handle_info(:check, state) do
    # Verify hub connectivity by checking if hub env vars are accessible
    hub_connected = System.get_env("LIVEBOOK_TEAMS_AUTH_MODE") != nil

    if hub_connected && @heartbeat_url do
      Req.get!(@heartbeat_url)
    end

    schedule()
    {:noreply, state}
  end

  defp schedule, do: Process.send_after(self(), :check, @check_interval)
end

{:ok, _pid} = GenServer.start_link(LivebookHubMonitor, nil, name: :hub_monitor)
IO.puts("Hub monitor running")

Run this cell in a persistent notebook that stays open on your Livebook server.


Step 6: SSL Certificate Monitoring

Livebook deployments are typically HTTPS-only. An expired certificate locks out all collaborators immediately.

  1. Click Add MonitorHTTP / HTTPS.
  2. Enter https://livebook.yourcompany.com/health.
  3. Under SSL Certificate, enable Cert expiry alerts.
  4. Set alert threshold: notify when certificate expires in < 21 days.

This gives you three weeks to renew before collaborators start seeing certificate errors.


Step 7: Set Up Alerts

  1. Go to Alert ChannelsAdd Channel.
  2. Choose Slack, Email, or PagerDuty.
  3. For the HTTP monitors: alert after 2 consecutive failures (avoids transient network noise).
  4. For scheduled notebook heartbeats: alert immediately on first miss.
  5. For SSL: alert via email with 21-day and 7-day warnings.
  6. Assign alert channels to all Livebook monitors.

For team deployments, also create a Status Page:

  1. Go to Status PagesCreate Page.
  2. Add your Livebook uptime monitor.
  3. Share the URL internally so the team can self-check before filing tickets.

Key Metrics to Watch

| Metric | Vigilmon feature | What to alert on | |---|---|---| | Server availability | HTTP monitor on /health | Any non-200 or timeout | | Web UI accessibility | HTTP monitor on / | Any non-200/302 | | Scheduled notebook completion | Heartbeat monitor | Missing for > grace period | | SSL certificate | Cert expiry monitor | Expires in < 21 days | | Response time | Response time chart | P95 > 3s (Livebook pages are heavier) |


Conclusion

Livebook is indispensable for Elixir data teams — but a server outage during an incident response is the worst time to discover your monitoring runbook isn't running. With Vigilmon watching your health endpoint, web UI, SSL certificate, and scheduled notebook heartbeats, your team has confidence that Livebook is always available when they need it.

Get started free at vigilmon.online.

Monitor your app with Vigilmon

Free plan — 5 monitors, no credit card required. Up and running in 60 seconds.

Start free →