xref: /aosp_15_r20/external/iproute2/README.lnstat (revision de1e4e894b0c224df933550f0afdecc354b238c4)
1*de1e4e89SAndroid Build Coastguard Workerlnstat - linux networking statistics
2*de1e4e89SAndroid Build Coastguard Worker(C) 2004 Harald Welte <[email protected]
3*de1e4e89SAndroid Build Coastguard Worker======================================================================
4*de1e4e89SAndroid Build Coastguard Worker
5*de1e4e89SAndroid Build Coastguard WorkerThis tool is a generalized and more feature-complete replacement for the old
6*de1e4e89SAndroid Build Coastguard Worker'rtstat' program.
7*de1e4e89SAndroid Build Coastguard Worker
8*de1e4e89SAndroid Build Coastguard WorkerIn addition to routing cache statistics, it supports any kind of statistics
9*de1e4e89SAndroid Build Coastguard Workerthe linux kernel exports via a file in /proc/net/stat.  In a stock 2.6.9
10*de1e4e89SAndroid Build Coastguard Workerkernel, this is
11*de1e4e89SAndroid Build Coastguard Worker	per-protocol neighbour cache statistics
12*de1e4e89SAndroid Build Coastguard Worker		(ipv4, ipv6, atm, decnet)
13*de1e4e89SAndroid Build Coastguard Worker	routing cache statistics
14*de1e4e89SAndroid Build Coastguard Worker		(ipv4)
15*de1e4e89SAndroid Build Coastguard Worker	connection tracking statistics
16*de1e4e89SAndroid Build Coastguard Worker		(ipv4)
17*de1e4e89SAndroid Build Coastguard Worker
18*de1e4e89SAndroid Build Coastguard WorkerPlease note that lnstat will adopt to any additional statistics that might be
19*de1e4e89SAndroid Build Coastguard Workeradded to the kernel at some later point
20*de1e4e89SAndroid Build Coastguard Worker
21*de1e4e89SAndroid Build Coastguard WorkerI personally always like examples more than any reference documentation, so I
22*de1e4e89SAndroid Build Coastguard Workerlist the following examples.  If somebody wants to do a manpage, feel free
23*de1e4e89SAndroid Build Coastguard Workerto send me a patch :)
24*de1e4e89SAndroid Build Coastguard Worker
25*de1e4e89SAndroid Build Coastguard WorkerEXAMPLES:
26*de1e4e89SAndroid Build Coastguard Worker
27*de1e4e89SAndroid Build Coastguard WorkerIn order to get a list of supported statistics files, you can run
28*de1e4e89SAndroid Build Coastguard Worker
29*de1e4e89SAndroid Build Coastguard Worker	lnstat -d
30*de1e4e89SAndroid Build Coastguard Worker
31*de1e4e89SAndroid Build Coastguard WorkerIt will display something like
32*de1e4e89SAndroid Build Coastguard Worker
33*de1e4e89SAndroid Build Coastguard Worker/proc/net/stat/arp_cache:
34*de1e4e89SAndroid Build Coastguard Worker         1: entries
35*de1e4e89SAndroid Build Coastguard Worker         2: allocs
36*de1e4e89SAndroid Build Coastguard Worker         3: destroys
37*de1e4e89SAndroid Build Coastguard Worker[...]
38*de1e4e89SAndroid Build Coastguard Worker/proc/net/stat/rt_cache:
39*de1e4e89SAndroid Build Coastguard Worker         1: entries
40*de1e4e89SAndroid Build Coastguard Worker         2: in_hit
41*de1e4e89SAndroid Build Coastguard Worker         3: in_slow_tot
42*de1e4e89SAndroid Build Coastguard Worker
43*de1e4e89SAndroid Build Coastguard WorkerYou can now select the files/keys you are interested by something like
44*de1e4e89SAndroid Build Coastguard Worker
45*de1e4e89SAndroid Build Coastguard Worker	lnstat -k arp_cache:entries,rt_cache:in_hit,arp_cache:destroys
46*de1e4e89SAndroid Build Coastguard Worker
47*de1e4e89SAndroid Build Coastguard Workerarp_cach|rt_cache|arp_cach|
48*de1e4e89SAndroid Build Coastguard Worker entries|  in_hit|destroys|
49*de1e4e89SAndroid Build Coastguard Worker       6|       6|       0|
50*de1e4e89SAndroid Build Coastguard Worker       6|       0|       0|
51*de1e4e89SAndroid Build Coastguard Worker       6|       2|       0|
52*de1e4e89SAndroid Build Coastguard Worker
53*de1e4e89SAndroid Build Coastguard Worker
54*de1e4e89SAndroid Build Coastguard WorkerYou can specify the interval (e.g. 10 seconds) by:
55*de1e4e89SAndroid Build Coastguard Worker
56*de1e4e89SAndroid Build Coastguard Worker	lnstat -i 10
57*de1e4e89SAndroid Build Coastguard Worker
58*de1e4e89SAndroid Build Coastguard WorkerYou can specify to only use one particular statistics file:
59*de1e4e89SAndroid Build Coastguard Worker
60*de1e4e89SAndroid Build Coastguard Worker	lnstat -f ip_conntrack
61*de1e4e89SAndroid Build Coastguard Worker
62*de1e4e89SAndroid Build Coastguard WorkerYou can specify individual field widths
63*de1e4e89SAndroid Build Coastguard Worker
64*de1e4e89SAndroid Build Coastguard Worker	lnstat -k arp_cache:entries,rt_cache:entries -w 20,8
65*de1e4e89SAndroid Build Coastguard Worker
66*de1e4e89SAndroid Build Coastguard WorkerYou can specify not to print a header at all
67*de1e4e89SAndroid Build Coastguard Worker
68*de1e4e89SAndroid Build Coastguard Worker	lnstat -s 0
69*de1e4e89SAndroid Build Coastguard Worker
70*de1e4e89SAndroid Build Coastguard WorkerYou can specify to print a header only at start of the program
71*de1e4e89SAndroid Build Coastguard Worker
72*de1e4e89SAndroid Build Coastguard Worker	lnstat -s 1
73*de1e4e89SAndroid Build Coastguard Worker
74*de1e4e89SAndroid Build Coastguard WorkerYou can specify to print a header at start and every 20 lines:
75*de1e4e89SAndroid Build Coastguard Worker
76*de1e4e89SAndroid Build Coastguard Worker	lnstat -s 20
77*de1e4e89SAndroid Build Coastguard Worker
78*de1e4e89SAndroid Build Coastguard WorkerYou can specify the number of samples you want to take (e.g. 5):
79*de1e4e89SAndroid Build Coastguard Worker
80*de1e4e89SAndroid Build Coastguard Worker	lnstat -c 5
81*de1e4e89SAndroid Build Coastguard Worker
82