Re: accessing iostat -x %b with a scripting language

2008-05-14 Thread Iv Ray

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
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


accessing iostat -x %b with a scripting language

2008-05-13 Thread Iv Ray
Is there a standard way to access, with a scripting language (php, perl, 
etc.) the output of -


iostat -x

I am particularly interested in the %b column (HDD utilization).

I am not sure if reading the output and regex-ing the Nth column is the 
right approach, or there is a more intelligent one.


Iv
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: accessing iostat -x %b with a scripting language

2008-05-13 Thread Johan Dowdy



What do you mean by access?

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?

-J



On 5/13/08 12:22 PM, Iv Ray [EMAIL PROTECTED] wrote:

 Is there a standard way to access, with a scripting language (php, perl,
 etc.) the output of -
 
 iostat -x
 
 I am particularly interested in the %b column (HDD utilization).
 
 I am not sure if reading the output and regex-ing the Nth column is the
 right approach, or there is a more intelligent one.
 
 Iv
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]

-- 
Johan Dowdy - CISSP
Senior Systems Administrator
nCircle Network Security
 
415.318.2880

Any sufficiently advanced technology is indistinguishable from magic.
-- Arthur C. Clarke

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]