FWIW, The code in Hobbit that processes the vmstat output takes this
into account.

Rich Smrcina
VM Assist, Inc.
Main: (866)569-7378
Cell: (414)491-6001

Catch the WAVV!  http://www.wavv.org
WAVV 2007 - Green Bay, WI

----- Original Message -----
From: "Edmund R. MacKenty" <[EMAIL PROTECTED]>
Date: Thursday, August 9, 2007 11:54 am
Subject: Re: How to translate Load Average to meaningful management numbers
To: [email protected]

> Actually, that shows the average CPU usage since last reboot,
> because vmstat's
> default output contains the average.  If you want to get the
> current CPU
> usage, you have to get two lines of output and it will give you the
> averageover the time between those two lines.  Thus "vmstat 1 2"
> will show the
> average over one second, and you can do this to get just the number
> you want:
>
> vmstat 1 2 | awk '{idle=$15} END {print 100 - idle}'
>
> (Note that I'm doing all the work Adam did with tail and the shell
> in awk
> here, because I like awk.  All its doing is collecting the 15th
> field from
> each line, and after the input ends its got the idle CPU value from
> the last
> line, which is what we need.)
>
> By changing that first argument to vmstat, you can get the average
> CPU usage
> over any number of seconds.
>       - MacK.
> -----
> Edmund R. MacKenty
> Software Architect
> Rocket Software, Inc.
> Newton, MA USA

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to