lnstat (8) Linux Manual Page
lnstat – unified linux network statistics
Synopsis
lnstat [options]
Description
This manual page documents briefly the lnstat command.
lnstat is a generalized and more feature-complete replacement for the old rtstat program. It is commonly used to periodically print a selection of statistical values exported by the kernel. In addition to routing cache statistics, it supports any kind of statistics the linux kernel exports via a file in /proc/net/stat/.
Each file in /proc/net/stat/ contains a header line listing the column names. These names are used by lnstat as keys for selecting which statistics to print. For every CPU present in the system, a line follows which lists the actual values for each column of the file. lnstat sums these values up (which in fact are counters) before printing them. After each interval, only the difference to the last value is printed.
Files and columns may be selected by using the -f and -k parameters. By default, all columns of all files are printed.
Options
lnstat supports the following options.
-h, –help- Show summary of options.
-V, –version- Show version of program.
-c, –count <count>- Print <count> number of intervals.
-d, –dump- Dump list of available files/keys.
-f, –file <file>- Statistics file to use, may be specified multiple times. By default all files in /proc/net/stat are scanned.
-i, –interval <intv>- Set interval to ‘intv’ seconds.
-j, –json- Display results in JSON format
-k, –keys k,k,k,…- Display only keys specified. Each key
kis of the form[file:]key. If<file>is given, the search for the given key is limited to that file. Otherwise the first file containing the searched key is being used. -s, –subject [0-2]- Specify display of subject/header. ‘0’ means no header at all, ‘1’ prints a header only at start of the program and ‘2’ prints a header every 20 lines.
-w, –width n,n,n,…- Width for each field.
Usage Examples
# lnstat -d- Get a list of supported statistics files.
# lnstat -k arp_cache:entries,rt_cache:in_hit,arp_cache:destroys- Select the specified files and keys.
# lnstat -i 10- Use an interval of 10 seconds.
# lnstat -f ip_conntrack- Use only the specified file for statistics.
# lnstat -s 0- Do not print a header at all.
# lnstat -s 20- Print a header at start and every 20 lines.
# lnstat -c -1 -i 1 -f rt_cache -k entries,in_hit,in_slow_tot- Display statistics for keys entries, in_hit and in_slow_tot of field rt_cache every second.
Files
/proc/net/stat/arp_cache, /proc/net/stat/ndisc_cache- Statistics around neighbor cache and ARP.
arp_cacheis for IPv4,ndisc_cacheis the same for IPv6.entriesNumber of entries in the neighbor table.allocsHow many neighbor entries have been allocated.destroysHow many neighbor entries have been removed.hash_growsHow often the neighbor (hash) table was increased.lookupsHow many lookups were performed.hitsHow manylookupswere successful.res_failedHow many neighbor lookups failed.rcv_probes_mcastHow many multicast neighbor solicitations were received. (IPv6 only.)rcv_probes_ucastHow many unicast neighbor solicitations were received. (IPv6 only.)periodic_gc_runsHow many garbage collection runs were executed.forced_gc_runsHow many forced garbage collection runs were executed. Happens when adding an entry and the table is too full.unresolved_discardsHow many neighbor table entries were discarded due to lookup failure.table_fullsNumber of table overflows. Happens if table is full and forced GC run (seeforced_gc_runs) has failed. /proc/net/stat/ip_conntrack, /proc/net/stat/nf_conntrack- Conntrack related counters.
ip_conntrackis for backwards compatibility with older userspace only and shows the same data asnf_conntrack.entriesNumber of entries in conntrack table.searchedNumber of conntrack table lookups performed.foundNumber ofsearchedentries which were successful.newNumber of conntrack entries added which were not expected before.invalidNumber of packets seen which can not be tracked.ignoreNumber of packets seen which are already connected to a conntrack entry.deleteNumber of conntrack entries which were removed.delete_listNumber of conntrack entries which were put to dying list.insertNumber of entries inserted into the list.insert_failedNumber of entries for which list insertion was attempted but failed (happens if the same entry is already present).dropNumber of packets dropped due to conntrack failure. Either new conntrack entry allocation failed, or protocol helper dropped the packet.early_dropNumber of dropped conntrack entries to make room for new ones, if maximum table size was reached.icmp_errorNumber of packets which could not be tracked due to error situation. This is a subset ofinvalid.expect_newNumber of conntrack entries added after an expectation for them was already present.expect_createNumber of expectations added.expect_deleteNumber of expectations deleted.search_restartNumber of conntrack table lookups which had to be restarted due to hashtable resizes. /proc/net/stat/rt_cache- Routing cache statistics.
entriesNumber of entries in routing cache.in_hitNumber of route cache hits for incoming packets. Deprecated since IP route cache removal, therefore always zero.in_slow_totNumber of routing cache entries added for input traffic.in_slow_mcNumber of multicast routing cache entries added for input traffic.in_no_routeNumber of input packets for which no routing table entry was found.in_brdNumber of matched input broadcast packets.in_martian_dstNumber of incoming martian destination packets.in_martian_srcNumber of incoming martian source packets.out_hitNumber of route cache hits for outgoing packets. Deprecated since IP route cache removal, therefore always zero.out_slow_totNumber of routing cache entries added for output traffic.out_slow_mcNumber of multicast routing cache entries added for output traffic.gc_totalTotal number of garbage collection runs. Deprecated since IP route cache removal, therefore always zero.gc_ignoredNumber of ignored garbage collection runs due to minimum GC interval not reached and routing cache not full. Deprecated since IP route cache removal, therefore always zero.gc_goal_missNumber of garbage collector goal misses. Deprecated since IP route cache removal, therefore always zero.gc_dst_overflowNumber of destination cache overflows. Deprecated since IP route cache removal, therefore always zero.in_hlist_searchNumber of hash table list traversals for input traffic. Deprecated since IP route cache removal, therefore always zero.out_hlist_searchNumber of hash table list traversals for output traffic. Deprecated since IP route cache removal, therefore always zero.
See Also
ip(8)
Author
lnstat was written by Harald Welte <laforge [at] gnumonks.org>.
This manual page was written by Michael Prokop <mika [at] grml.org> for the Debian project (but may be used by others).
