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