From owner-freebsd-fs@FreeBSD.ORG Fri Dec 2 15:07:22 2011 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC0B1106566B for ; Fri, 2 Dec 2011 15:07:22 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta10.westchester.pa.mail.comcast.net (qmta10.westchester.pa.mail.comcast.net [76.96.62.17]) by mx1.freebsd.org (Postfix) with ESMTP id 8A1CB8FC14 for ; Fri, 2 Dec 2011 15:07:22 +0000 (UTC) Received: from omta19.westchester.pa.mail.comcast.net ([76.96.62.98]) by qmta10.westchester.pa.mail.comcast.net with comcast id 4CZz1i00327AodY5AF7NJr; Fri, 02 Dec 2011 15:07:22 +0000 Received: from koitsu.dyndns.org ([67.180.84.87]) by omta19.westchester.pa.mail.comcast.net with comcast id 4F7M1i01c1t3BNj3fF7NAt; Fri, 02 Dec 2011 15:07:22 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id B24F5102C1D; Fri, 2 Dec 2011 07:07:20 -0800 (PST) Date: Fri, 2 Dec 2011 07:07:20 -0800 From: Jeremy Chadwick To: Ronald Klop Message-ID: <20111202150720.GA28016@icarus.home.lan> References: <4ED8D7A5.7090700@icritical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-fs@freebsd.org Subject: Re: Monitoring ZFS IO X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2011 15:07:22 -0000 On Fri, Dec 02, 2011 at 03:47:38PM +0100, Ronald Klop wrote: > On Fri, 02 Dec 2011 14:50:29 +0100, Matt Burke > 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 |