Tuesday, April 30, 2013

kstat Structures

kstat structures are created by system components to contain information about component characteristics that need to be measured. Each component has its own format for kstat information. This information is queried by monitoring commands.

Much of the same information (and even configurable access to the kstat structures themselves) is available through the dtrace command.

The libkstat library contains C-language functions available to programs which need to access the kstat structure. The /dev/kstat pseudo-device is the driver for this access.

Prior to Solaris 10, the netstat -k provided a listing of several kstat structures. Starting with Solaris 8, the /bin/kstat command has allowed access to particular kstats. The rest of this page focuses on the /bin/kstat command.

A particular statistic man be specified by 4-tuples of the following sort:
module:instance:name:statistic
where each element may be either a shell glob or a Perl regular expression enclosed in '/' (forward-slash) characters. The -m, -i , -n and -s options may be used to match a particular object (or glob of objects).

At the end of a kstat command, numbers representing intervals and count may be added.

kstat -l
lists kstat names but not values. For a given kernel module, the command
kstat -l -m module-name
lists all available kstat measurements for that module.

No comments: