Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 May 2008 11:06:17 +0200
From:      Iv Ray <pobox@verysmall.org>
To:        Johan Dowdy <jdowdy@ncircle.com>,  FreeBSD Questions <questions@freebsd.org>
Subject:   Re: accessing iostat -x %b with a scripting language
Message-ID:  <482AAB89.1010504@verysmall.org>
In-Reply-To: <C44F3E5A.99770%jdowdy@ncircle.com>
References:  <C44F3E5A.99770%jdowdy@ncircle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Johan Dowdy wrote:
 > What do you mean by "access"?

I mean "read", sorry for the unclear question.

 > A simple way to get the output would be(presuming the 8th column has the
 > data you want):
 > iostat -x | awk '{ print $8 }'
 > This could be redirected to a file or processed ins a shell script etc.
 >
 > What is it that you want to "do' with the output?

I want to add performance monitoring functionality to a web applications.

I look for bottlenecks on each request.

For this I want to "read" several OS status indicators such as %b of 
"iostat -x".

What I was not sure about, was - what is the correct way to "read" the 
output of "iostat -x" (and of other similar commands, such as "top", etc.).

But from the posts, so far, it seems that the correct way is indeed to 
"parse" the output, which the command would normally send to the 
terminal, and to "find" my values in this output, relying that the 
command will always output the values in the given order/format.

This -

iostat -x | awk '{ print $8 }'

returns multi-row answer.

This (suggested in another post) -

iostat -x | grep ad0 | tr -s ' ' | cut -d ' ' -f 8

grep to pick the drive in question
tr to cleanup the line
cut to extract the value

returns exactly the value of the %b.

Thank you all,
Iv



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?482AAB89.1010504>