How to distinguish between virtual interface and physical interface by metrics?

119 views
Skip to first unread message

koly li

unread,
Sep 21, 2022, 5:10:47 AM9/21/22
to Prometheus Users
On a machine, there are many interfaces, some are virtual some are physical. How to get the info about interface type(virtual or pyhsical) through metrics?

currently, i cannot find any metric with these info.
And there is another thread related which is not merged to node exporter.

Brian Candler

unread,
Sep 21, 2022, 12:52:23 PM9/21/22
to Prometheus Users
Looks like that merge is blocked because the code does things which node_exporter forbids (shelling out to executable 'lspci')

Have you tried the ethtool collector? You'll have to enable it explicitly:

I see metrics like these:

node_ethtool_info{bus_info="0000:03:00.0",device="enp3s0",driver="r8169",expansion_rom_version="",firmware_version="rtl8168g-2_0.0.1 02/06/13",version=""} 1
node_ethtool_info{bus_info="0000:02:00.0",device="wlp2s0",driver="iwlwifi",expansion_rom_version="",firmware_version="17.3216344376.0",version="5.4.0-125-generic"} 1
node_ethtool_info{bus_info="",device="vlan256",driver="802.1Q VLAN Support",expansion_rom_version="",firmware_version="N/A",version="1.8"} 1
node_ethtool_info{bus_info="N/A",device="br256",driver="bridge",expansion_rom_version="",firmware_version="N/A",version="2.3"} 1
node_ethtool_info{bus_info="",device="veth0798c11e",driver="veth",expansion_rom_version="",firmware_version="",version="1.0"} 1

(The first two are physical, last three are virtual).  You might be able to use bus_info and/or driver to distinguish them appropriately.

Otherwise you can use the textfile_collector, and write a small cronjob which collects the information you want and writes it to a file. There are some examples in this repo:
Reply all
Reply to author
Forward
Message has been deleted
0 new messages