We have a challenge with mapping the file system mount point (e.g. /usr) to the kstat name used to collect the iostats. We use code rather than the actual commands listed below, but the mapping is done like this:
First the device name:
% df /
/ (/dev/dsk/c3t0d0s0 ): 2065804 blocks 1019523 files
% ls -l /dev/dsk/c3t0d0s0
lrwxrwxrwx 1 root root 65 Dec 27 2005 /dev/dsk/c3t0d0s0 -> ../../devices/pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/sd@0,0:a
strip "../../devices" and trailing ":%c" which is the partition
% grep /pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/sd@0,0 /etc/path_to_inst
"/pci@7c0/pci@0/pci@1/pci@0,2/LSILogic,sas@2/sd@0,0" 3 "sd"
Gives us the 3 pieces ("sd", 3, "a") needed to get the metrics using the kstat api:
% kstat -n sd3,a
module: sd instance: 3
name: sd3,a class: partition
crtime 171.04862756
nread 923651720
...
This code was written before opensolaris was available.. I just had a look at how the iostat command maps the kstat name to disk name when you specify the -n switch, it's not pretty.
If anybody knows a simple way to do this mapping, I'd be happy to hear about it!
You can use the device name displayed by iostat (w/o the -n switch), for example 'sd1' with Sigar.getDiskUsage("sd1"). You'll see the same list of names with: kstat -c disk
We also plan to implement an API to get the list of disks: http://jira.hyperic.com/browse/SIGAR-113
|