LAN/WAN/WiFi Metrics Via Prometheus & SNMP

overall_network_traffic.jpg

lan_network_traffic.jpg

wifi_network_traffic.jpg

When I set up these panels I wanted a global overview of which interface incoming data was be downloaded on.

Keep in mind that since the WAN panel includes metrics from both the WiFi and LAN interfaces, the graphs may actually look very similar - but if you've correctly identified the interfaces, you should see some very small variations when the graphs look similar. For example - 

  • If WiFI is downloading alot, but LAN isn't downloading anything, the WAN panel will look very much like the WiFI panel since the WAN panel is an aggregation of both the LAN and WiFi panel and the LAN panel currently isn't showing anything downloading.
  • However, if both WiFi and LAN are downloading large amounts at the same time, the WAN panel will show a combination of both metrics and thus will likely look very different.

This tutorial assumes you have the SNMP connector installed, the Prometheus data source operating, and of course Grafana. See tutorials below under Dependencies.

This tutorial is cross platform compatible.

Dependencies

Interfaces

The following designations are how Prometheus identifies each interface on your DD-WRT router. These designations are DD-WRT specific and will not likely be available on other router firmware.

These interface designations are DD-WRT specific. If your router does not have the DD-WRT firmware installed, these designations will probably either be named something else entirely, or may not even exist. Click here to see the official DD-WRT installation tutorial. There are also several useful Youtube tutorials.

eth0 = physical network interface
eth1 = physical interface for 2.4 GHz
eth2 = physical interface for 5 GHz
vlan1 = virtual interface for all lan ports
vlan2 = virtual interface for wan port
br0 = bridge interface connecting vlan1, eth1, and eth2

1. Setting up the overall WAN traffic panel

overall_network_traffic.jpg

Create a new graph panel in Grafana with the Prometheus data source and add the following Prometheus queries:

Outgoing WAN data Prometheus query:
sum by(status)(irate(ifOutOctets{ifDescr="br0",ifIndex="1",instance="192.168.1.1",job="snmp"}[20m]))
Incoming WAN data Prometheus query:
sum by(status)(irate(ifInOctets{ifDescr="br0",ifIndex="1",instance="192.168.1.1",job="snmp"}[20m]))

Screenshot of the actual query entered into Prometheus:

overall_network_traffic_query_screenshot.jpg

2. Setting up the overall LAN traffic panel

lan_network_traffic.jpg

Create a new graph panel in Grafana with the Prometheus data source and add the following Prometheus queries:

Outgoing LAN data Prometheus query:
sum by(status)(irate(ifOutOctets{ifDescr="vlan1",ifIndex="2",instance="192.168.1.1",job="snmp"}[20m]))
Incoming LAN data Prometheus query:
sum by(status)(irate(ifInOctets{ifDescr="vlan1",ifIndex="2",instance="192.168.1.1",job="snmp"}[20m]))

Screenshot of the actual query entered into Prometheus:

lan_traffic_query_screenshot.jpg

3. Setting up the overall WiFi traffic panel

wifi_network_traffic.jpg

Create a new graph panel in Grafana with the Prometheus data source and add the following Prometheus queries:

Outgoing WiFi data Prometheus query:
sum by(status)(irate(ifOutOctets{ifDescr="eth1",ifIndex="5",instance="192.168.1.1",job="snmp"}[20m]))
Incoming WiFi data Prometheus query:
sum by(status)(irate(ifInOctets{ifDescr="eth1",ifIndex="5",instance="192.168.1.1",job="snmp"}[20m]))

wifi_network_traffic_query_screenshot.jpg


Revision #12
Created Thu, Aug 22, 2019 5:24 PM by Cameron
Updated Thu, Aug 22, 2019 6:42 PM by Cameron