glances
glances copied to clipboard
Use glances network alias if available
Is your feature request related to a problem? Please describe.
I have a dual boot machine with Arch and Windows 11. I figured I'd set up glances on Windows since both installs use the same IP, it'd basically be portable. The only issue is, the network interface name on Arch is enp7s0
and Ethernet
on Windows. As I'd like to keep both names to their defaults, I added the following to my glances.conf
on Windows:
[network]
Ethernet_alias=enp7s0
Now the Ethernet
adapter appears as enp7s0
in the web interface, and if we look at http://localhost:61208/api/3/network
, an alias
value has been added:
{
"interface_name": "Ethernet",
"alias": "enp7s0",
"time_since_update": 8.07380199432373,
"cumulative_rx": 52488594,
"rx": 41836,
"cumulative_tx": 6760822,
"tx": 22377,
"cumulative_cx": 59249416,
"cx": 64213,
"is_up": true,
"speed": 1048576000,
"key": "interface_name"
}
I presume Homepage fetches the network interface using the value of interface_name
, regardless if it has an alias, so it still fails to grab the network interface.
Describe the solution you'd like
If the value of alias
is null
, use interface_name
. If the value of alias
is anything else, use alias
for the network interface name.
Describe alternatives you've considered
- Renaming either network interface on my system: I'd like to keep both interface names to their defaults to prevent any potential configuration issues on either system.
Hi @LeviSnoot
in Glances version 4 (future version under development), the default behavor for the aliases will be the following.
[network]
alias=enp7s0:Ethernet
Result in the API:
{
"interface_name": "enp7s0",
"alias": "Ethernet",
"time_since_update": 8.07380199432373,
"cumulative_rx": 52488594,
"rx": 41836,
"cumulative_tx": 6760822,
"tx": 22377,
"cumulative_cx": 59249416,
"cx": 64213,
"is_up": true,
"speed": 1048576000,
"key": "interface_name"
}