Skip to content

Prometheus Metrics

tempus2016 edited this page Nov 16, 2026 · 1 revision

Prometheus metrics

The app can serve its device and network data for Prometheus to collect, for graphs in Grafana or similar tools. It's off until you set it up.

Turning it on

  1. On the app's Configuration tab, set metrics_token to a long random string, 16 characters or more.
  2. On the same tab, under Network, give port 9099/tcp a host port, for example 9099.
  3. Restart the app.

The endpoint stays off while metrics_token is empty or the port isn't mapped.

Scrape config

Add a scrape job to Prometheus:

scrape_configs:
  - job_name: z2m_tracker
    authorization:
      credentials: <your metrics_token>
    static_configs:
      - targets: ["homeassistant.local:9099"]

Use your Home Assistant host's name or address, and the host port you mapped.

Every request must send the token, or it gets 401. The endpoint serves only /metrics and changes nothing. The data includes device names and areas, so keep the token private.

What it serves

Each active device has these gauges, with ieee, name and network labels:

Metric What it is
z2m_tracker_device_online 1 online, 0 offline. Missing when Zigbee2MQTT availability is off.
z2m_tracker_device_linkquality Last reported link quality (0–255).
z2m_tracker_device_linkquality_24h Average link quality over the last 24 hours.
z2m_tracker_device_battery_percent Last reported battery level.
z2m_tracker_device_battery_days_left Estimated days until the battery runs low. See Estimates.
z2m_tracker_device_last_seen_timestamp_seconds When the device last sent anything (Unix time).
z2m_tracker_device_messages_24h Messages received in the last 24 hours.
z2m_tracker_device_uptime_30d_percent Share of the last 30 days the device was online.
z2m_tracker_device_issues Open health issues for the device.
z2m_tracker_device_info Always 1. Adds type, power_source, vendor, model and area labels.

And these totals:

Metric What it is
z2m_tracker_network_devices Devices per network and status. The coordinator isn't counted.
z2m_tracker_issues Open health issues per check and severity.
z2m_tracker_network_online 1 when that network's Zigbee2MQTT reports online.
z2m_tracker_alerts_paused 1 while alerts are paused.
z2m_tracker_info Always 1, with the app version as a label.

Clone this wiki locally