Node_exporter: Expand netdev_linux to include more information from /sys/class/net/*/

Created on 22 Jan 2018  路  3Comments  路  Source: prometheus/node_exporter

Linux allows for an administratively set port description for network interfaces, this can be configured with iproute2 using ip link set dev eth0 alias "LAN interface". This is similar to IF-MIB::ifAlias or IF-MIB::ifDescr in the land of SNMP.

On Cumulus Linux platforms (a fork of Debian), ifupdown2 allows setting this as part of the /etc/network/interfaces file.

We (@SFMIX) use this for noting which ports are peering participants, backhaul transport, and/or management. We're trying to avoid using the snmp_exporter, since the node_exporter is faster and meets 99% of our requirements. The goal is to filter based on regex of port description for these different used interface descriptions.

It looks like the netdev_linux code parses /proc/net/dev file for counters (at least from my horrible Go code parsing skills, or lack of). This data is present in /sys/class/net/eth0/ifalias.

Host operating system: output of uname -a

Linux switch02-sfo02 4.1.0-cl-6-amd64 #1 SMP Cumulus 4.1.33-1+cl3u11 (2018-01-04) x86_64 GNU/Linux

node_exporter version: output of node_exporter --version

node_exporter, version 0.15.2 (branch: HEAD, revision: 98bc64930d34878b84a0f87dfe6e1a6da61e532d)
  build user:       root@d5c4792c921f
  build date:       20171205-14:50:53
  go version:       go1.9.2

node_exporter command line flags

./node_exporter --collector.bonding --collector.logind --collector.interrupts --collector.systemd --web.listen-address="100.64.0.7:9100"

Are you running node_exporter in Docker?

No

accepted enhancement help wanted

Most helpful comment

Sure, this sounds like a good idea. There are a number of extra things in /sys/class/net/*/ I have been wanting to implement.

For reference, the documentation is here

For example, speed is a common request. Also operstate or maybe carrier.

All 3 comments

Technically FreeBSD has description too, probably other OS's wouldn't be surprising.

Sure, this sounds like a good idea. There are a number of extra things in /sys/class/net/*/ I have been wanting to implement.

For reference, the documentation is here

For example, speed is a common request. Also operstate or maybe carrier.

hello! I wanted to check if the operstate part has been currently implemented in node_exporter or not? We are using the following linux OS -

uname -a
Linux <host-name> 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

We use Prometheus Operator for monitoring and this is our currently implemented node_exporter version -

quay.io/prometheus/node-exporter:v0.16.0
Was this page helpful?
0 / 5 - 0 ratings