prometheus / prometheus/procfs
VRF association in NetClassIface
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 883
- Forks
- 388
- Avg merge
- 13h 28m
- Merged PRs (30d)
- 3
Description
Hi,
One metric dimension that I am missing from Node Exporter is the VRF association for interfaces.
It looks like the current implementation relies on reading /sys/class/net. For VRFs this is visible as a generic upper (or master) / lower hierarchy.
Example:
bluecmd@adele:/sys/class/net/Ethernet92$ ls -lah
total 0
drwxr-xr-x 5 root root 0 Aug 2 15:06 .
drwxr-xr-x 122 root root 0 Aug 2 15:06 ..
-r--r--r-- 1 root root 4.0K Aug 2 15:06 addr_assign_type
-r--r--r-- 1 root root 4.0K Aug 2 15:06 address
[..]
-r--r--r-- 1 root root 4.0K Aug 2 15:06 iflink
-r--r--r-- 1 root root 4.0K Aug 2 15:06 link_mode
lrwxrwxrwx 1 root root 0 Aug 2 15:06 master -> ../VrfKamel
-rw-r--r-- 1 root root 4.0K Aug 2 15:06 mtu
[..]
-rw-r--r-- 1 root root 4.0K Aug 2 15:06 uevent
lrwxrwxrwx 1 root root 0 Aug 2 15:06 upper_VrfKamel -> ../VrfKamel
However, sadly, the VrfKamel master directory does not contain anything saying that it is a VRF interface. The type file would be my first guess but that appears to be more "What kind of protocol does this interface handle?" which is both 1 for EthernetX and VrfX.
The better way appears to use netlink to find the VRFs:
bluecmd@adele:/sys/class/net/eth0$ ip link show type vrf
9: mgmt: <NOARP,MASTER,UP,LOWER_UP> mtu 65536 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether d6:1e:f6:a2:87:b9 brd ff:ff:ff:ff:ff:ff
12: VrfKamel: <NOARP,MASTER,UP,LOWER_UP> mtu 65536 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 66:d8:f1:b8:0f:96 brd ff:ff:ff:ff:ff:ff
14: VrfMainframe: <NOARP,MASTER,UP,LOWER_UP> mtu 65536 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 8e:37:34:f5:bd:e3 brd ff:ff:ff:ff:ff:ff
Happy to take any questions or suggestions! Might even end up making a PR for it if the stars align and we can figure out a design :-).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the NetClassIface implementation and its existing reading of /sys/class/net, then compare that approach with the issue's netlink example using ip link show type vrf. Done means exposing the VRF association for interfaces reliably, with the design for identifying VRF interfaces resolved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, linux
- Domain
- networking, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100