htop
htop copied to clipboard
Add Meter Choice framework
Add the possibility for meters to have selectable choices, so they can display more exact information the user is interested in.
As examples the following meters are added:
- Hostname: show the IP address based on the selected network interface
- DiskUsage: show the space utilization based on the selected mountpoint
- NetworkIO: show the IO usage based on the selected network interface
- LibSensorsFan: show the speed based on the selected libsensors provided sensor
- LibSensorsTemp: show the temperature based on the selected libsensors provided sensor
Data is only available on Linux for now.
Not tested, but does this list all local IP addresses, or does it select one? Like: Waht happens on a multihomed system with e.g. LAN+wireless+VPN?
Only the the first (whatever the kernel decides to be first) non-loopback link-local IP address is displayed.
Maybe in the future Meters can have runtime options, which can be set per enabled-meter (like display-mode). Than one can select which IP to display.
$ ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
inet 10.116.112.196/24 brd 10.116.112.255 scope global dynamic noprefixroute eth0
inet6 fe80::fedc:ba98:7654:3210/64 scope link noprefixroute
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
inet 10.116.128.196/17 brd 10.116.255.255 scope global dynamic noprefixroute wlan0
inet6 2a07:1:9:6:7:7:5:e/64 scope global temporary dynamic
inet6 2a07:1:9:6:e:0:a:f/64 scope global dynamic mngtmpaddr noprefixroute
inet6 fc00::4242:9:a:1:a/64 scope global temporary dynamic
inet6 fc00::4242:8:7:e:4/64 scope global dynamic mngtmpaddr noprefixroute
inet6 fe80::e:a:6:2/64 scope link noprefixroute
4: br-lxc: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
inet 192.168.254.1/24 brd 192.168.254.255 scope global br-lxc
inet6 fe80::c000:8000:4000:23/64 scope link
5: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
7: lxcbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
inet 10.0.3.1/24 scope global lxcbr0
$ ip r s
default via 10.116.112.254 dev eth0 proto dhcp metric 100
default via 10.116.128.6 dev wlan0 proto dhcp metric 600
10.0.3.0/24 dev lxcbr0 proto kernel scope link src 10.0.3.1 linkdown
10.116.112.0/24 dev eth0 proto kernel scope link src 10.116.112.196 metric 100
10.116.128.0/17 dev wlan0 proto kernel scope link src 10.116.128.196 metric 600
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown
192.168.254.0/24 dev br-lxc proto kernel scope link src 192.168.254.1
$ ip -6 r s
::1 dev lo proto kernel metric 256 pref medium
2a07:1:9:6::/64 dev wlan0 proto ra metric 600 pref medium
fc00:0:0:4242::/64 dev wlan0 proto ra metric 600 pref medium
fe80::/64 dev eth0 proto kernel metric 100 pref medium
fe80::/64 dev br-lxc proto kernel metric 256 pref medium
fe80::/64 dev wlan0 proto kernel metric 600 pref medium
default via fe80::cafe:beef:beef:1 dev wlan0 proto ra metric 600 pref medium
Expected behaviour:
IPv4: 10.116.112.196
(Default with lowest metric)
IPv6: 2a07:1:9:6:e:0:a:f
(Routable global network address on default-routed interface)
While fc00::4242:8:7:e:4 would be correct too, it's an ULA, and thus not globally routable.
For the difference between dynamic mngtmpaddr noprefixroute
and temporary dynamic
see the docs ;-)
Congratulations :tada:. DeepCode analyzed your code in 2.417 seconds and we found no issues. Enjoy a moment of no bugs :sunny:.
👉 View analysis in DeepCode’s Dashboard | Configure the bot
Please fix the compilation issues that the CI complains about …
Testing the Disk Usage meter the UX is not the best. Especially as it does not filter /snap
, /run
and several other memory FS. Furthermore the UI hangs if the filesystem is not reachable (e.g. with CIFS).
For the Hostname
meter I'd like to have a combined Host IPv4/IPv6 meter to reduce information duplication. Or just have a blank IP address meter.
Wondering if choices should have a preferred sorting order (either enforced by the "choice provider" or by the "meter framework".