Skip to content
Guides

Monitor n8n: health checks, Prometheus metrics and alerts

How to monitor a self-hosted n8n: /healthz and readiness checks, the Prometheus /metrics endpoint, failed-run metrics, alerts, and OpenTelemetry traces.

By then8nblog Editors5 min read
Tested on n8n 2.47.5intermediate
Illustration of monitoring n8n: the /healthz and /healthz/readiness checks, Prometheus metrics with N8N_METRICS, failed executions by workflow, and OpenTelemetry traces

To monitor a self-hosted n8n, point an uptime checker at /healthz/readiness (200 means n8n is up and its database is connected and migrated), and set N8N_METRICS=true so Prometheus can scrape /metrics, which includes how long each workflow run took and whether it succeeded or failed. Add an error workflow for alerts on individual failures, and OpenTelemetry traces if you need to follow one execution through your stack. Keep /metrics off the public internet: it answers without a login.

The short version:

CheckEndpoint or settingWhat it tells you
Is the process up?/healthz200 if n8n is reachable; says nothing about the database
Can it serve traffic?/healthz/readiness200 if the database is connected and migrated
How is it doing?/metrics with N8N_METRICS=truePrometheus metrics: run durations and status, memory, event loop lag, active workflows
Did a workflow fail?An error workflow, or the metric status="failed"An alert per failed run, or a failure rate over time
Where did a run spend its time?OpenTelemetry, N8N_OTEL_ENABLED=trueTraces per workflow and node (Preview)

We checked the endpoints and metrics below on n8n 2.47.5, the current stable release, with a local instance and two webhook workflows, one of which fails on purpose.

Health checks: /healthz and /healthz/readiness

n8n's monitoring docs describe two health endpoints:

  • /healthz returns 200 when the instance is reachable. It "doesn't indicate DB status". It works on self-hosted and Cloud.
  • /healthz/readiness returns 200 only when the database is connected and migrated, so the instance is ready to accept traffic.

Both answered {"status":"ok"} with status 200 in our test:

curl -s https://n8n.example.com/healthz
# {"status":"ok"}
curl -s https://n8n.example.com/healthz/readiness
# {"status":"ok"}

Use /healthz for a liveness check (restart the container if it stops answering) and /healthz/readiness for uptime monitoring and load balancers, because a running process with a broken database connection still passes /healthz. The path can be changed with N8N_ENDPOINT_HEALTH (default healthz), per the endpoints reference.

In queue mode, the docs note that workers don't serve the health endpoint by default. Set QUEUE_HEALTH_CHECK_ACTIVE=true on the workers to turn it on.

Turn on Prometheus metrics

The /metrics endpoint is off by default. Turn it on with one variable:

services:
  n8n:
    environment:
      N8N_METRICS: "true"

Per the Prometheus docs page, n8n uses the prom-client library, and both main and worker instances can expose metrics. The endpoint is available on every self-hosted edition, but not on n8n Cloud.

What you get

With N8N_METRICS=true (and the workflow ID label described below), our instance exposed 71 n8n_ metric families (the prefix is set by N8N_METRICS_PREFIX). The useful ones for a first dashboard:

  • n8n_workflow_execution_duration_seconds: a histogram of run durations with status and mode labels. After three successful and two failing webhook runs, its _count showed status="success" 3 and status="failed" 2, both with mode="webhook".
  • n8n_active_workflow_count: the number of active workflows.
  • n8n_nodejs_eventloop_lag_seconds and the n8n_nodejs_heap_size_* metrics: event loop lag and memory, the first signs of an overloaded instance.
  • n8n_process_resident_memory_bytes and n8n_process_cpu_seconds_total: process memory and CPU.
  • n8n_version_info: the running version as labels, handy to spot instances that missed an update. Ours read version="v2.47.5".

The Node.js and process metrics come from N8N_METRICS_INCLUDE_DEFAULT_METRICS, which defaults to true.

Labels and extra metric groups

The endpoints reference lists the switches, all false by default except the default metrics. The ones most people want:

  • N8N_METRICS_INCLUDE_WORKFLOW_ID_LABEL: adds a workflow_id label to workflow metrics. With it on, we could see which workflow failed (workflow_id="..." on the failed series). Leave it off if you have thousands of workflows, since every label value is a new time series.
  • N8N_METRICS_INCLUDE_QUEUE_METRICS: job counts for queue mode (active, completed, failed), exposed on the main instances and refreshed every N8N_METRICS_QUEUE_METRICS_INTERVAL seconds (default 20).
  • N8N_METRICS_INCLUDE_API_ENDPOINTS, with optional path, method and status code labels: metrics for API calls.
  • N8N_METRICS_INCLUDE_NODE_TYPE_LABEL and N8N_METRICS_INCLUDE_CREDENTIAL_TYPE_LABEL: node and credential type labels.
  • Newer groups for the durable scheduler, polling triggers, system tasks and SSRF protection, each with its own N8N_METRICS_INCLUDE_* variable.

Scrape it with Prometheus and graph it in Grafana

n8n's Grafana page gives the Prometheus scrape job:

scrape_configs:
  - job_name: n8n
    static_configs:
      - targets:
          - n8n:5678
    metrics_path: /metrics

Use the address Prometheus can reach on your internal network, such as the Compose service name. Then add Prometheus as a Grafana data source (Connections > Data sources > Add new data source > Prometheus). n8n also publishes reusable Grafana dashboards in its n8n-observability repository, according to the same page.

Alerts that are worth having

Monitoring only helps if something tells you when it breaks. Three alerts cover most self-hosted instances:

  1. Readiness fails. Any uptime checker that calls /healthz/readiness every minute or so. Our website uptime monitor template can check that URL from another n8n instance; a check from outside the server is what you want, because it still works when this n8n is down.
  2. Failures rise. In Prometheus, alert when the rate of n8n_workflow_execution_duration_seconds_count{status="failed"} goes above what's normal for you. The exact threshold depends on your workflows.
  3. A specific workflow fails. An error workflow with the Error Trigger tells you which run failed and why. Our error handling guide sets one up, and the failed-runs digest template sends one Telegram summary a day instead of one message per failure.

Add disk space to the list if you self-host on a small server: execution data grows until pruning removes it. Our guide to pruning execution data explains the defaults.

OpenTelemetry traces (Preview)

For a view inside each run, n8n can export OpenTelemetry traces for workflow and node executions. The docs mark it as Preview since n8n 2.19.0 and advise against relying on it in production. The basics:

N8N_OTEL_ENABLED=true
N8N_OTEL_EXPORTER_OTLP_ENDPOINT=http://<your-collector-host>:4318
  • n8n appends /v1/traces to the endpoint, so give it the collector's base URL.
  • Owners and admins can also configure it in Settings > OpenTelemetry (from 2.27.0), and gRPC is supported from 2.39.0.
  • By default only production executions are traced; N8N_OTEL_TRACES_PRODUCTION_ONLY=false includes manual runs, and N8N_OTEL_TRACES_SAMPLE_RATE (0 to 1) reduces volume.

We didn't test tracing for this guide.

Next steps

Sources

  1. Monitoring, healthz and metrics endpoints (n8n docs)
  2. Enable Prometheus metrics (n8n docs)
  3. Endpoints environment variables, N8N_METRICS_* (n8n docs)
  4. Visualize metrics with Grafana (n8n docs)
  5. OpenTelemetry tracing (n8n docs)

then8nblog Editors

Editorial team

The then8nblog editorial team researches every article from n8n's release notes, documentation and source code, states the n8n version each guide was tested on, and has every post reviewed by a human editor before it goes live.