sar
You can use sar to obtain System ActivityReporter reports, which show the file read/write status, system call usage, disk I/O, CPU utilization, memory usage, process activities, and IPC-related activities. You can use sar to monitor network conditions.
CLI mode:
sar -n [keyword] [ <interval> [ <count> ] ]
Parameters:
-n: monitors network performance.
Valid keywords:
- DEV: displays network interface information.
- EDEV: displays statistics on network errors.
- NFS: collects statistics about active NFS clients.
- NFSD: collects statistics about the NFS server.
- SOCK: displays socket information.
- ALL: displays all five switches.
interval: the output refresh interval.
count: the number of output times.
You can run the sar -n command to view the transmission rate on each NIC. Sample code:
$sar -n DEV 1
09:01:53 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s
09:01:54 PM lo 7.07 7.07 0.45 0.45 0.00 0.00 0.00
09:01:54 PM eth0 62.63 19.19 4.18 2.57 0.00 0.00 0.00
09:01:54 PM eth1 0.00 0.00 0.00 0.00 0.00 0.00 0.00
09:01:54 PM bond0 62.63 19.19 4.18 2.57 0.00 0.00 0.00
Field description:
IFACE: the name of the server NIC.
rxpck/s: the number of packets received per second.
txpck/s: the number of packets sent per second.
rxKB/S: the size of packets received per second, in KB.
txKB/S: the size of packets sent per second, in KB.
rxcmp/s: the number of compressed packets received per second.
txcmp/s: the number of compressed packets sent per second.
rxmcst/s: the number of multicast packets received per second.
vsar
You can use vsar to trace the network load over a period.
Run the vsar --traffic --tcp command to trace the historical network load. Sample code:
Time -------------------------------tcp------------------------------ ---------------------traffic--------------------
Time active pasive iseg outseg EstRes AtmpFa CurrEs retran bytin bytout pktin pktout pkterr pktdrp
18/10/21-16:22:28 2.20 27.40 249.60 222.20 0.20 0.00 223.00 0.00 50.0K 37.2K 249.00 202.00 0.00 0.00
18/10/21-16:22:33 3.20 20.60 247.40 230.60 0.00 0.00 198.00 0.00 76.6K 32.0K 256.00 205.00 0.00 0.00
18/10/21-16:22:38 2.00 25.60 3.6K 50.5K 0.00 0.00 216.00 0.01 276.8K 73.4M 3.6K 50.5K 0.00 0.00
18/10/21-16:22:43 3.80 29.00 243.80 214.60 0.00 0.00 232.00 0.47 53.1K 32.1K 255.00 206.00 0.00 0.00
18/10/21-16:22:48 2.00 31.20 251.20 217.00 0.00 1.00 238.00 0.46 53.5K 35.1K 274.00 221.00 0.00 0.00
18/10/21-16:22:53 1.20 25.60 2.6K 37.1K 0.00 0.00 228.00 0.00 207.8K 54.1M 2.6K 37.1K 0.00 0.00
18/10/21-16:22:58 0.40 27.00 1.2K 16.6K 0.00 0.00 225.00 0.00 110.0K 24.1M 1.2K 16.6K 0.00 0.00
18/10/21-16:23:03 2.40 25.60 3.7K 50.4K 0.00 0.00 217.00 0.00 281.3K 73.4M 3.7K 50.4K 0.00 0.00
Field description:
tcp
- active: the number of connections initiated actively per second.
- pasive: the number of passively established connections per second.
- iseg: the number of inbound TCP packets per second.
- outseg: the number of outbound TCP packets per second.
- EstRes: the number of connections reset per second.
- AtmpFa: the number of connection initiation failures per second. For example, the failure can be caused if the syn packet is discarded because the semi-join queue is full.
- CurrEs: the number of current TCP connections.
- retran: the retransmission rate calculated based on the retransmitted segments and the total segments.
traffic
- bytin: the number of bytes received by the physical host NIC per second. Generally, 960 MB is the upper limit for a 10 GE NIC.
- bytout: the number of bytes sent by the physical host NIC per second.
- pktin: the number of packets received by the physical host NIC per second.
- pktout: the number of packets sent by the physical host NIC per second.
- inerr: the number of inbound packet errors.
- outerr: the number of outbound packet errors.
- indrp: the number of inbound packets dropped.
- outdrp: the number of outbound packets dropped.