Closed HolyPrapor closed 3 years ago
According to official documentation, we can look at the source code there.
After analyzing source code files, we can conclude, that current teaming mode can be obtained in /run/teamd/<iface>.conf
.
There lies JSON configuration file.
Teaming ports can be gathered either looking at /sys/class/net/<iface>/lower_<port iface>
directories, or traversing /sys/class/net/<iface>
directories and looking at their master.
Perhaps, there might be other sources of information.
There are 6 cases to handle:
Previous comment did not take into consideration two things:
/sys/class/net/<iface>/lower_<port iface>
and /sys/class/net/<iface>/master
may not exist..conf
files may contain obsolete information. This leads us to the conclusion that actual state may be obtained only through teamlib calls.
For better understanding I suggest reading this specification first.
We can extract needed info (teaming mode and slave-ports) using StateDump
method.
It's implementation is located there.
It requires teamdctl
context, which should be prepared.
We can find teamdctl
struct there.
1) Allocation 2) Connection to needed port
There are also:
It should be possible to get all needed methods from libteamdctl.so.0
library.
I managed to retreive actual JSON configuration of interface using method described above, but I faced two issues:
sudo
There is a chance that teamdctl
address can be retreived somewhere and then used to connect to the Netlink Socket (to communicate with driver). If it's true, then we will be able to retreive needed data without sudo
. Worth investigating
Unfortunately we are unable to retreive needed data without sudo
.
Now this is a requirement to collect full host metrics on Linux.
We can use teamdctl team0 state item get setup.runner_name
to get current teaming mode.
To retreive ports we can use teamdctl team0 state dump
(JSON).
Because of the old kernel version getting team interface bandwidth on CentOS fails.
The task is to handle different teaming modes and calculate bandwidth accordingly.
https://kontur.slack.com/archives/CE3EZ7924/p1612180262246400