Skip to content
Contents
GuidesOpenWrt

How to show OpenWrt DHCP hostnames next to MAC addresses in Grafana

Start with the source of the name. The OpenWrt 25.12 uci_dhcp_host collector reads configured host entries. A name in a dynamic lease may never reach this metric.

Start with the source of the name. The OpenWrt 25.12 uci_dhcp_host collector reads configured host entries. A name in a dynamic lease may never reach this metric.

Does a lease mean the client is online?

These SSH captures use two OpenWrt 25.12.6 VMs. The client replied after obtaining an address. We shut it down and the lease remained. We know when it stopped. A ping timeout alone cannot establish that.

uci show dhcp | grep '=host$'
ubus call luci-rpc getDHCPLeases '{}' | jsonfilter -e '@.dhcp_leases[*]'

lab-client · DHCPv4 · ping 2/2

lab-client · DHCPv4 · ping 0/2

Check the scrape endpoint

Check the optional package below and substitute your actual endpoint on the management network. If the metric is absent, check installation, scrape status and names in static leases. For dynamic clients keep a separate name map rather than changing address allocation. Keep the endpoint private.

apk info -e prometheus-node-exporter-lua-uci_dhcp_host
wget -qO- http://127.0.0.1:9100/metrics | grep uci_dhcp_host

If needed, install the matching collector by its full package name in LuCI. Restart the exporter if necessary and wait one scrape interval. A value of 1 marks a configured entry. Resolve duplicate keys and normalize case at collection time. The example assumes no existing name label and one router per instance.

Join in a copy of the panel

Replace traffic_bytes with your metric. Both sides need the same router instance and matching mac labels. The collector uses uppercase MACs. Confirm the name metric exists. The first query should return no duplicates. Run the second and use name and mac in the legend. Unmatched series are retained.

count by (instance, mac) (uci_dhcp_host{mac!="",name!=""}) > 1
(
  traffic_bytes{mac!=""}
  * on (instance, mac) group_left(name)
    uci_dhcp_host{mac!="", name!=""}
)
or on (instance, mac)
  traffic_bytes

Grafana · Legend → Custom → {{name}} {{mac}}

Compare a named and an unnamed device at the same instant. Values should match the original panel. Restore the old query if rows disappear or labels conflict. We checked collector output with sample configuration, without testing your dashboard.

Why does LuCI still show the old hostname after renaming an OpenWrt router?

Explore hardware

Comments