next up previous
Next: About this document ...

NSTAT, IFSTAT and RTACCT Utilities

Alexey Kuznetsov, kuznet@ms2.inr.ac.ru

some_negative_number, 20 Sep 2001

These utilities are very similar, so that I describe them simultaneously, using name Xstat in the places which apply to all of them.

The format of the command is:


\begin{tscreen}
\begin{verbatim}Xstat [ OPTIONS ] [ PATTERN [ PATTERN ... ] ]\end{verbatim}
\end{tscreen}

PATTERN is shell style pattern, selecting identifier of SNMP variables or interfaces to show. Variable is displayed if one of patterns matches its name. If no patterns are given, Xstat assumes that user wants to see all the variables.

OPTIONS is list of single letter options, using common unix conventions.

History is just dump saved in file /tmp/.Xstat.uUID or in file given by environment variables NSTAT_HISTORY, IFSTAT_HISTORY and RTACCT_HISTORY. Each time when you use Xstat values there are updated. If you use patterns, only the values which you _really_ see are updated. If you want to skip an unintersting period, use option -n, or just output to /dev/null.

Xstat understands when history is invalidated by system reboot or source of information switched between different instances of daemonic Xstat and kernel SNMP tables and does not use invalid history.

Beware, Xstat will not produce sane output, when many processes use it simultaneously. If several processes under single user need this utility they should use environment variables to put their history in safe places or to use it with options -a -s.

Well, that's all. The utility is very simple, but nevertheless very handy.

Output of XSTAT

The first line of output is # followed by identifier of source of information, it may be word kernel, when Xstat gets information from kernel or some dotted decimal number followed by parameters, when it obtains information from running Xstat daemon.

In the case of nstat the rest of output consists of three columns: SNMP MIB identifier, its value (or increment since previous measurement) and average rate of increase of the counter per second. ifstat outputs interface name followed by pairs of counter and rate of its change.

Daemonic Xstat

Xstat may be started as daemon by any user. This makes sense to avoid wrapped counters and to obtain reasonable long counters for large time. Also Xstat daemon calculates average rates. For the first goal sampling interval (option -d) may be large enough, f.e. for gigabit rates byte counters overflow not more frequently than each 40 seconds and you may select interval of 20 seconds. From the other hand, when Xstat is used for estimating rates interval should be less than averaging period (option -t), otherwise estimation loses in quality.

Client Xstat, before trying to get information from the kernel, contacts daemon started by this user, then it tries system wide daemon, which is supposed to be started by superuser. And only if none of them replied it gets information from kernel.

Environment

NSTAT_HISTORY - name of history file for nstat.

IFSTAT_HISTORY - name of history file for ifstat.

RTACCT_HISTORY - name of history file for rtacct.




next up previous
Next: About this document ...