Monitoring OpenWrt with Grafana and Prometheus

Openwrt Monitoring via Grafana. (kind of rough, but works for me :slight_smile: )

This project consists of a few applications to help monitor your home router. You will need a decent router (anything from 3yrs ago will work) dual core CPU, with 256mb of RAM and 128mb nand and a home server running docker.

Router:
Install Collectd, Prometheus Plugins and IPTMON

Home Server:
Install Docker and run the Docker-Compose file. (make sure to update the prometheus.yml file with your server IP)

Credit: I started with this dashboard from Matthew Helmke and added some stuff.






Install Collectd on Openwrt router

opkg update
opkg install collectd collectd-mod-contextswitch collectd-mod-cpu  collectd-mod-dhcpleases /
collectd-mod-disk collectd-mod-dns collectd-mod-ethstat /
collectd-mod-interface collectd-mod-iptables collectd-mod-iwinfo /
collectd-mod-load collectd-mod-memory collectd-mod-network /
collectd-mod-ping collectd-mod-processes collectd-mod-protocols /
collectd-mod-rrdtool collectd-mod-tcpconns collectd-mod-uptime

Collectd – After installing collectd on the router, you will need to configure the plugins such as ping and firewall via luci

  • make sure to configure your output, it has to point to your collectd-exporter.

  • Configure CollectD firewall → statistics → collectd. (make sure to configure the firewall like shown below).


Prometheus – Use this guide to install Prometheus on the router (How I monitor my OpenWrt router with Grafana Cloud and Prometheus | Grafana Labs)

opkg install prometheus prometheus-node-exporter-lua prometheus-node-exporter-lua-nat_traffic \
prometheus-node-exporter-lua-netstat prometheus-node-exporter-lua-openwrt \ prometheus-node-exporter-lua-uci_dhcp_host prometheus-node-exporter-lua-wifi \
prometheus-node-exporter-lua-wifi_stations collectd-mod-dhcpleases

IPTMON.ipk – Use this guide to install iptmon on the router (GitHub - oofnikj/iptmon: simple iptables bandwidth monitor)
NOTE: If you care about SQM/CAKE/ETC, it will probably not play nice with iptmon reporting.

Install IPTMON on OpenWRT

VERSION=0.1.6
wget https://github.com/oofnikj/iptmon/releases/download/v${VERSION}/iptmon_${VERSION}-1_all.ipk -O iptmon_${VERSION}-1_all.ipk
opkg install ./iptmon_${VERSION}-1_all.ipk

Docker-Compose.yml

sudo docker-compose up -d

2 Likes

Thanks for sharing this with the tech community Ben. Moving this to the Showcase forum.

1 Like