Hi community,
specifically I’m trying to resolve visualization of Routing Tables of Network devices. However, I’m looking for general solution to visualize any table formatted data in specific way. Basically my question is if this is possible with InfluxDB & Grafana and how should I approach to get it done. So please read my explanation and share your ideas.
Prerequisites:
I use gnmic to collect routing table changes via streaming telemetry from network devices. Whenever there is a change in the Network Device routing table it is streamed to gnmic which forwards it to influxdb.
This is example of one routing table change event from the network device as seen by gnmic:
{
"source": "clab-tellab-xrd-telemetry-rtr1:57400",
"subscription-name": "default-1710430190",
"timestamp": 1710430943297000000,
"time": "2024-03-14T17:42:23.297+02:00",
"prefix": "Cisco-IOS-XR-ip-rib-ipv4-oper:",
"updates": [
{
"Path": "rib/vrfs/vrf[vrf-name=Mgmt]/afs/af[af-name=IPv4]/safs/saf[saf-name=Unicast]/ip-rib-route-table-names/ip-rib-route-table-name[route-table-name=default]/routes/route[address=1.1.1.1][prefix-length=32]",
"values": {
"rib/vrfs/vrf/afs/af/safs/saf/ip-rib-route-table-names/ip-rib-route-table-name/routes/route": {
"distance": 1,
"extended-flags": "0",
"flags": 0,
"flow-tag": 0,
"fwd-class": 0,
"metric": 0,
"paths-count": 2,
"priority": 9,
"protocol-id": 2,
"protocol-name": "static",
"qos-group": 255,
"route-path": {
"ipv4-rib-edm-path": [
{
"address": "172.26.0.1",
"backup-pathid": 0,
"binding-label": 1048577,
"flags": 0,
"has-labelstk": false,
"information-source": "0.0.0.0",
"load-metric": 0,
"metric": 0,
"mvpn-present": false,
"next-hop-afi": 0,
"next-hop-id": 0,
"next-hop-safi": 0,
"next-hop-table-id": 0,
"num-labels": 0,
"number-of-extended-communities": 0,
"pathid": 0,
"route-label": 1048577,
"segmented-nexthop-present": false,
"source-asrt-present": false,
"source-rd-present": false,
"tunnel-id": 0,
"v6-information-source": "::",
"v6-nexthop": "::",
"vrf-import-rt-present": false
},
{
"address": "172.26.100.100",
"backup-pathid": 0,
"binding-label": 1048577,
"flags": 0,
"has-labelstk": false,
"information-source": "0.0.0.0",
"load-metric": 0,
"metric": 0,
"mvpn-present": false,
"next-hop-afi": 0,
"next-hop-id": 0,
"next-hop-safi": 0,
"next-hop-table-id": 0,
"num-labels": 0,
"number-of-extended-communities": 0,
"pathid": 0,
"route-label": 1048577,
"segmented-nexthop-present": false,
"source-asrt-present": false,
"source-rd-present": false,
"tunnel-id": 0,
"v6-information-source": "::",
"v6-nexthop": "::",
"vrf-import-rt-present": false
}
]
},
"route-precedence": 255,
"route-type": 1,
"tag": 0
}
}
}
]
}
In influxdb it is seen like this (csv export):
#group false false true true false false true true true true true true true true true
#datatype string long dateTime:RFC3339 dateTime:RFC3339 dateTime:RFC3339 string string string string string string string string string string
#default last
result table _start _stop _time _value _field _measurement af_af-name ip-rib-route-table-name_route-table-name route_address route_prefix-length saf_saf-name source vrf_vrf-name
0 2024-03-14T07:48:24.986113516Z 2024-03-15T07:48:24.986113516Z 2024-03-14T16:28:00Z 1.1.1.1 Cisco-IOS-XR-ip-rib-ipv4-oper:/rib/vrfs/vrf/afs/af/safs/saf/ip-rib-route-table-names/ip-rib-route-table-name/routes/route/prefix rib IPv4 default 1.1.1.1 32 Unicast clab-tellab-xrd-telemetry-rtr1 Mgmt
First goal: Single table with latest values in the selected grafana time range
At first I want to have single table. It should not have Time as column anymore but rather collect latest entries of all prefixes in a given time range.
So let’s say first prefix (1.1.1.1/32) have multiple events during the time frame with different Nexthop values. Only the latest entry (with nexthops 172.26.0.1, 172.26.100.100) should be present in the table.
Also all of the prefixes (1.1.1.1/32, 2.2.2.2/32 and 4.4.0.0/16) might have events (during the time range) in totally different timestamps.
This way the table presents state of the routing table at the End of the Time range selected.
How this could be achieved?
I see JSON has complex structure and for example Nexthops are under route-path.ipv4-rib-edm-path
list in address
item. We don’t have to solve all at once. So you can assume everthing is in the same table in the influxdb.
Second goal: Compare same table at two different points in time
Let’s say this is the state of the Table at 30 minutes ago:
And this is the same table now (30 minutes later):
I want to see table view of showing differences between these two timestamps:
How this could be achieved?
I think solution for this would be pretty powerfull for multiple table formatted data scenarios regarding Network devices (Routing table, MAC table, ARP table etc) and may be usefull for other industries as well.
Any comments are highly appreciated.