Nicstat
From Siwiki
Contents |
[edit] Synopsis
nicstat [-hnsz] [-i interface[,...]] | [interval [count]]
[edit] Description
The nicstat utility displays network interface statistics for all active interfaces on the system. It is to network interfaces what "prstat" is to processes, and "iostat" is to disks.
When nicstat starts, it display statistics for the period from when the system booted until the present.
If you specify an interval, nicstat then displays statistics each interval seconds.
If you also specify a count, nicstat continues to display statistics each interval seconds for count iterations.
[edit] Options
[edit] -h
Display help on standard error
[edit] -n
Show non-local interfaces only (exclude the loopback interface)
[edit] -s
Summary output (see Examples)
[edit] -z
Skip zero-value lines (no input or output on that interface for that interval). This is similar to the -z option on the iostat command.
[edit] -i interface[,...]
Only display statistics for the selected interface(s). Multiple interfaces can be specified, separated by commas (,).
[edit] Examples
Display statistics for all interfaces every 5 seconds:
$ nicstat 5
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
17:05:17 lo0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
17:05:17 e1000g0 0.61 4.07 4.95 6.63 126.2 628.0 0.04 0.00
17:05:17 e1000g1 225.7 176.2 905.0 922.5 255.4 195.6 0.33 0.00
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
17:05:22 lo0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
17:05:22 e1000g0 0.06 0.15 1.00 0.80 64.00 186.0 0.00 0.00
17:05:22 e1000g1 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Display statistics for the "e1000g" interface every 5 seconds, for 4 iterations:
$ nicstat -i e1000g0 5 4
Time Int rKB/s wKB/s rPk/s wPk/s rAvs wAvs %Util Sat
17:08:49 e1000g0 0.61 4.07 4.95 6.63 126.2 628.0 0.04 0.00
17:08:54 e1000g0 0.06 0.04 1.00 0.20 64.00 186.0 0.00 0.00
17:08:59 e1000g0 239.2 2.33 174.4 33.60 1404.4 71.11 1.98 0.00
17:09:04 e1000g0 0.01 0.04 0.20 0.20 64.00 186.0 0.00 0.00
Display "summary" statistics for all interfaces, excluding "zero" samples:
$ nicstat -sz 5
Time Int rKB/s wKB/s
13:27:03 lo0 0.000 0.000
13:27:03 ipge0 31.870 16.549
Time Int rKB/s wKB/s
13:27:08 lo0 0.000 0.000
13:27:08 ipge0 14.179 15.541
Time Int rKB/s wKB/s
13:27:13 lo0 0.000 0.000
13:27:13 ipge0 24.308 14.415
^C
[edit] Caveats
The interpretation of "zero" is that no packets were sent or received. This can be misleading with the "-s" flag on the loopback interface, as Solaris captures read and written packets for the loopback interface, but does not capture read or written bytes.
[edit] Availability & History
nicstat was originally written by Brendan Gregg. Tim Cook is also a contributor, and wrote the Linux version.
Source and binaries for nicstat, for Solaris and Linux are available at blogs.sun.com/timc.
An older Perl version of nicstat that reads Solaris kstats is also available in Brendan's K9 toolkit
