The Grafana Network Graph panel doesn’t just show you connections; it visualizes the flow of data, highlighting bottlenecks and dependencies you’d otherwise miss.

Let’s see it in action. Imagine you have Prometheus scraping metrics from your network devices. We’ll use those metrics to build a live, interactive map.

Here’s a basic Prometheus query to get interface traffic data:

sum by (instance, interface, direction) (rate(if_octets{direction="rx"}[5m]))

This query sums up the received bytes per second (rx direction) for each instance (your network device) and interface over the last 5 minutes. You’d have a similar query for transmitted bytes (tx).

Now, in Grafana, add a new panel and select the "Network Graph" visualization.

For the "Data" tab, you’ll configure your Prometheus data source. In the "Queries" section, you’ll input your PromQL queries.

Crucially, you need to map your Prometheus metrics to the Network Graph panel’s fields.

  • Nodes: This is where your devices appear. You’ll typically map the instance label from your Prometheus metric to the "Node ID" field. You might also map instance to "Node Name" for better readability.
  • Edges: These represent the connections between your nodes. The panel infers edges based on traffic flow. You’ll map the interface label to the "Edge ID" field. The "Source" and "Target" fields will be derived from how your network devices report traffic. If a device reports traffic for eth0 and another for eth1, and traffic flows between them, the panel will draw an edge.

Let’s refine this. For a more robust topology, you’ll want to include metrics that define the relationships between devices, not just traffic on individual interfaces. Tools like snmp_exporter can expose interface connection information. If you can get Prometheus to record which interface on device A is connected to which interface on device B, that’s gold.

Consider a scenario where you’re using snmp_exporter and have metrics like ifAlias or ifDesc. You could use a query like:

node_network_info{device="eth0"}

This might give you labels indicating the connected peer. The Network Graph panel can then use these inferred relationships to draw edges.

The real power comes from customizing the graph’s appearance and behavior. In the "Display" tab:

  • Node Limit: Set this based on your network size. Too high, and it becomes unusable.
  • Edge Threshold: This is vital. Set a minimum traffic value (e.g., 1000 bytes/sec) to only show active links, reducing clutter.
  • Coloring: You can color nodes and edges based on metrics. For instance, color nodes red if CPU usage exceeds 80%, or color edges blue if traffic is below a certain threshold and yellow if it’s high. This is configured in the "Node Properties" and "Edge Properties" sections by adding custom fields and mapping them to colors.

For example, to color nodes by their current received traffic:

  1. Add a new "Node Property".
  2. Name it "RX Speed".
  3. Set "Field" to your rate(if_octets{direction="rx"}) query.
  4. In the "Color" mapping, define thresholds: e.g., 0-10000 (Green), 10001-50000 (Yellow), 50001+ (Red).

The panel intelligently infers connections by looking at traffic patterns reported by your data source. If device A consistently shows traffic on interface eth0 that corresponds to traffic received on device B’s interface eth1, the panel will draw an edge between node A and node B. It’s not about explicitly defining A -> B; it’s about observing the data flow and constructing the graph from it.

A common pitfall is not having consistent labeling across your Prometheus metrics. If one device labels its instance as server-01 and another as 192.168.1.10, the graph won’t be able to correlate them effectively. Ensure your instance labels are resolvable hostnames or consistent identifiers.

When you’re setting up the "Node ID" mapping, if your Prometheus instance label is something like hostname:port, you might want to use a Grafana transformation to extract just the hostname before mapping it to "Node ID" to avoid clutter.

The next challenge is correlating latency or packet loss metrics with this visual topology.

Want structured learning?

Take the full Grafana course →