How to use the command bmon (with examples)
- Linux
- December 25, 2023
The bmon
command is used to monitor bandwidth and capture network-related statistics. It provides real-time information about data transfer rates, network interfaces, and more.
Use case 1: Display the list of all the interfaces
Code:
bmon -a
Motivation: This use case allows you to view a list of all the network interfaces available on your system. It can be helpful when troubleshooting network connectivity issues or when you need to specify a specific interface for monitoring.
Explanation: The -a
option is used to display all the available network interfaces.
Example output:
Interface Received Sent Total
------------------ ----------------- ----------------- --------
eth0 10KB 20KB 30KB
eth1 5KB 15KB 20KB
lo 2KB 2KB 4KB
Use case 2: Display data transfer rates in bits per second
Code:
bmon -b
Motivation: Monitoring data transfer rates in bits per second allows you to get a more granular view of network traffic. This can be useful in situations where you need to identify and troubleshoot potential bottlenecks or high traffic usage.
Explanation: The -b
option is used to display the data transfer rates in bits per second.
Example output:
Interface Received Sent Total
------------------ ----------------- ----------------- --------
eth0 100Mbps 200Mbps 300Mbps
eth1 50Mbps 150Mbps 200Mbps
lo 20Mbps 20Mbps 40Mbps
Use case 3: Set policy to define which network interface(s) is/are displayed
Code:
bmon -p interface_1,interface_2,interface_3
Motivation: Setting a policy to define which network interface(s) are displayed allows you to customize the monitoring output based on your specific needs. You can choose to monitor only the interfaces that are relevant to your current task or troubleshoot.
Explanation: The -p
option is used to set a policy for displaying specific network interfaces. You need to provide a comma-separated list of interface names as arguments.
Example output:
Interface Received Sent Total
------------------ ----------------- ----------------- --------
eth0 10KB 20KB 30KB
eth1 5KB 15KB 20KB
Use case 4: Set interval (in seconds) in which rate per counter is calculated
Code:
bmon -R 2.0
Motivation: Setting the interval for rate per counter calculation allows you to control the frequency at which the data transfer rates are updated. This can be useful when you need to monitor network traffic in near-real-time or when you want to reduce the amount of network bandwidth used by the monitoring tool.
Explanation: The -R
option is used to set the interval (in seconds) for rate per counter calculation. In the example, the interval is set to 2.0 seconds.
Example output:
Interface Received Sent Total
------------------ ----------------- ----------------- --------
eth0 100Mbps 200Mbps 300Mbps
eth1 50Mbps 150Mbps 200Mbps
lo 20Mbps 20Mbps 40Mbps
Conclusion:
The bmon
command is a versatile tool for monitoring network bandwidth and capturing network-related statistics. By using the various options and arguments, you can customize the output to suit your specific monitoring needs. Whether you need to view a list of interfaces, monitor data transfer rates, define a specific policy, or set the update interval, bmon
has got you covered.