ifstat - Report InterFace STATistics
Ifstat is a little tool to report interface activity, just like iostat/vmstat do for other system statistics.
SYNOPSIS
ifstat [-a] [-l] [-z] [-n] [-v] [-h] [-t] [-i if0,if1,...] [-d drv[:opt]] [-s [comm@][#]host[/nn]] [-T] [-A] [-w] [-W] [-S] [-b] [-q]
[delay[/delay] [count]]
OPTIONS
-l Enables monitoring of loopback interfaces for which statistics are available. By default, ifstat monitors all non-loopback interfaces
that are up.
-l 确保监控有返回数据的接口其数据统计适能。 默认情况,ifstat 监控所有没有返回的接口。
Example:
root@localhost:/tmp> ifconfig
eth0 Link encap:Ethernet HWaddr 00:1E:8C:50:64:B9
inet addr:172.16.0.2 Bcast:172.16.0.255 Mask:255.255.255.0
inet6 addr: fe80::21e:8cff:fe50:64b9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7813059 errors:0 dropped:0 overruns:0 frame:0
TX packets:6213047 errors:0 dropped:0 overruns:0 carrier:2
collisions:0 txqueuelen:1000
RX bytes:2849810777 (2.6 GiB) TX bytes:2700161629 (2.5 GiB)
Memory:fbfc0000-fc000000
eth0:1 Link encap:Ethernet HWaddr 00:1E:8C:50:64:B9
inet addr:10.0.0.1 Bcast:128.224.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Memory:fbfc0000-fc000000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:7175 errors:0 dropped:0 overruns:0 frame:0
TX packets:7175 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:208533 (203.6 KiB) TX bytes:208533 (203.6 KiB)
root@localhost:/tmp> ifstat -l
lo eth0
KB/s in KB/s out KB/s in KB/s out
0.00 0.00 0.39 0.19
0.00 0.00 0.45 0.14
0.00 0.00 0.70 0.14
.....
eth0 Link encap:Ethernet HWaddr 00:1E:8C:50:64:B9
inet addr:172.16.0.2 Bcast:172.16.0.255 Mask:255.255.255.0
inet6 addr: fe80::21e:8cff:fe50:64b9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7813059 errors:0 dropped:0 overruns:0 frame:0
TX packets:6213047 errors:0 dropped:0 overruns:0 carrier:2
collisions:0 txqueuelen:1000
RX bytes:2849810777 (2.6 GiB) TX bytes:2700161629 (2.5 GiB)
Memory:fbfc0000-fc000000
eth0:1 Link encap:Ethernet HWaddr 00:1E:8C:50:64:B9
inet addr:10.0.0.1 Bcast:128.224.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Memory:fbfc0000-fc000000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:7175 errors:0 dropped:0 overruns:0 frame:0
TX packets:7175 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:208533 (203.6 KiB) TX bytes:208533 (203.6 KiB)
root@localhost:/tmp> ifstat -l
lo eth0
KB/s in KB/s out KB/s in KB/s out
0.00 0.00 0.39 0.19
0.00 0.00 0.45 0.14
0.00 0.00 0.70 0.14
.....
-a Enables monitoring of all interfaces found for which statistics are available.
-a 确保监控所有的接口都已经找到其数据统计功能适能。
Example:
root@localhost:/tmp> ifstat -a
lo eth0 wlan0
KB/s in KB/s out KB/s in KB/s out KB/s in KB/s out
0.00 0.00 1.08 0.22 0.00 0.00
0.00 0.00 0.71 0.16 0.00 0.00
0.00 0.00 0.24 0.16 0.00 0.00
0.00 0.00 0.53 0.16 0.00 0.00
0.00 0.00 1.16 0.16 0.00 0.00
0.00 0.00 0.36 0.16 0.00 0.00
0.00 0.00 0.64 0.16 0.00 0.00
lo eth0 wlan0
KB/s in KB/s out KB/s in KB/s out KB/s in KB/s out
0.00 0.00 1.08 0.22 0.00 0.00
0.00 0.00 0.71 0.16 0.00 0.00
0.00 0.00 0.24 0.16 0.00 0.00
0.00 0.00 0.53 0.16 0.00 0.00
0.00 0.00 1.16 0.16 0.00 0.00
0.00 0.00 0.36 0.16 0.00 0.00
0.00 0.00 0.64 0.16 0.00 0.00
-z Hides interface which counters are null, eg interfaces that are up but not used.
-z 屏蔽计数器内数据为空的接口。
例如,一个接口已经适能但没有数据进/出通过这个接口。
Example:
-z 屏蔽计数器内数据为空的接口。
例如,一个接口已经适能但没有数据进/出通过这个接口。
Example:
root@localhost:/tmp> ifstat -z
eth0
KB/s in KB/s out
1.46 0.14
0.24 0.13
1.13 0.13
0.69 0.13
1.00 0.13
0.36 0.19
eth0
KB/s in KB/s out
1.46 0.14
0.24 0.13
1.13 0.13
0.69 0.13
1.00 0.13
0.36 0.19
-i Specifies the list of interfaces to monitor, separated by commas (if an interface name has a comma, it can be escaped with '\'). Mul‐
tiple instances of the options are added together.
-s Equivalent to -d snmp:[comm@][#]host[/nn]] to poll a remote host through SNMP. See below for details.
-h Displays a short help message.
-n Turns off displaying the header periodically.
-t Adds a timestamp at the beginning of each line.
-T Reports total bandwith for all monitored interfaces.
-A Disables use of interface indexes: by default, when polling mechanism is index based (snmp, ifmib), ifstat remembers indexes of moni‐
tored interfaces to poll only them. However, if interfaces indexes change often (new interfaces added, etc), you might loose some
stats, hence this flag. Note that if you ask ifstat to monitor a non existent interface, it will poll all interfaces until it finds
the requested one (regardless of this flag) so you can poll for an interface that goes up and down.
-w Uses fixed width columns, instead of enlarging them if needed for interfaces names to fit.
-W Wrap lines that are larger than the terminal width (implies -w). Wrapped lines are prefixed with a cycling letter to ease reading.
-S Keep stats updated on the same line if possible (no scrolling nor wrapping).
-b Reports bandwith in kbits/sec instead of kbytes/sec.
-q Quiet mode, warnings are not printed.
-v Displays version and the compiled-in drivers.
转载于:https://blog.51cto.com/leonkuo/588110