Monitoring ZFS IO

Jeremy Chadwick freebsd at jdc.parodius.com
Fri Dec 2 15:07:22 UTC 2011


On Fri, Dec 02, 2011 at 03:47:38PM +0100, Ronald Klop wrote:
> On Fri, 02 Dec 2011 14:50:29 +0100, Matt Burke
> <mattblists at icritical.com> wrote:
> 
> >Can someone enlighten me as to how to get 'iostat -Id' or 'iostat -Idx'
> >style counters for zpools?
> >
> >I've read through the man pages, but all I can see is 'zpool
> >iostat' which
> >gives values which appear to be averaged over an unspecified time period.
> >
> >
> >With a 30-disk zpool, I can't fathom out how to get any meaningful data
> >from the individual disk stats, and keeping a daemon running
> >'zpool iostat
> >N' just to parse its output seems hugely inefficient and hacky...
> >
> >
> >
> >Thanks.
> >
> 
> while true; do gstat -b -I 1s; done

...which is valid, but is still an "averaged" value.  Additionally,
this does not get the OP correlation between devices and ZFS-related
bits (e.g. pool, vdev, etc.).

"zpool iostat -v N" or "zpool iostat -v pool N" would be how to
accomplish that -- except 1) this does not behave like gstat -b, and 2)
does not provide the amount of device-level granularity the OP may want.
The -v flag will show both device and vdev statistics.  One problem with
"zpool iostat" is that it only gives you human-readable numbers; if
you're using this in a script you not only have to handle parsing unit
types (requiring you to go look at the C code for it, which I believe
lives in libzfs or libzpool, I forget -- I have done it), but worse, you
lose accuracy given rounding and unit conversion.  There's no code to
make it show integers or floats, at least not last time I looked (last
year).

A combination of two utilities may be needed -- something that parses
"zpool status" to learn what devices are associated with what pool/vdev,
and then runs "gstat -b 1s" and gets the actual "low-level" details
desired.  This should be a not-too-difficult job for any nominal perl
programmer (at work I wrote our check_zpool_status Nagios-like check,
which parses "zpool status" for example; lots of nuances though,
especially between ZFS versions since the output actually has changed
over time).

But again, depending on what the OP wants, these are still "averages
over short periods of time" (gstat example = 1 second) rather than
incrementing counters or what iostat without an interval argument
provides (average over entire system uptime).

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                   Mountain View, CA, US |
| Making life hard for others since 1977.               PGP 4BD6C0CB |



More information about the freebsd-fs mailing list