From owner-freebsd-questions@FreeBSD.ORG Wed May 14 09:14:09 2008 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 203231065673 for ; Wed, 14 May 2008 09:14:09 +0000 (UTC) (envelope-from pobox@verysmall.org) Received: from uranos.boku.ac.at (uranos.boku.ac.at [141.244.180.250]) by mx1.freebsd.org (Postfix) with ESMTP id D34D48FC19 for ; Wed, 14 May 2008 09:14:08 +0000 (UTC) (envelope-from pobox@verysmall.org) Received: by uranos.boku.ac.at (Postfix, from userid 1001) id 202FF33821F; Wed, 14 May 2008 11:14:07 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on uranos.boku.ac.at X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.4 Received: from localhost (localhost [127.0.0.1]) by uranos.boku.ac.at (Postfix) with ESMTP id 5389333821D; Wed, 14 May 2008 11:14:06 +0200 (CEST) Received: from uranos.boku.ac.at ([127.0.0.1]) by localhost (uranos.boku.ac.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 21207-02; Wed, 14 May 2008 11:14:04 +0200 (CEST) Received: from [141.244.63.108] (unknown [141.244.63.108]) by uranos.boku.ac.at (Postfix) with ESMTP id 8B0EE338213; Wed, 14 May 2008 11:14:04 +0200 (CEST) Message-ID: <482AAB89.1010504@verysmall.org> Date: Wed, 14 May 2008 11:06:17 +0200 From: Iv Ray User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Johan Dowdy , FreeBSD Questions References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: powered by ZID at uranos.boku.ac.at Cc: Subject: Re: accessing iostat -x %b with a scripting language X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 May 2008 09:14:09 -0000 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