On Linux, how can I (programmatically) retrieve the following counters on a per-interface basis:
The i option of the netstat command shows the state of the network interfaces that are configured on the local system. With this option, you can determine the number of packets a system transmits and receives on each network. Display the status of interfaces on the network.
1. Log in to the system as root and run ifconfig -a plumb in a command shell. The command discovers all installed network interfaces.
The ip link command allows you to modify the transmit queue, speeding up or slowing down interfaces to reflect your needs and hardware possibilities.
On my system, there are files under /sys/class/net/eth0/statistics
, which gives various stats about network interfaces.
This is assuming a vaguely recent Linux which has /sys
(sysfs) mounted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With