[ale] Best command for cpu utilization

Mike Millson mgm at atsga.com
Tue Jan 7 12:08:27 EST 2003


xosview looks great. What I'm trying to do is find a way to feed cpu
utilization values to MRTG, so I need some sort of command line output.

What about sar -u 1? Is this a good way to get cpu utilization for MRTG?
iostat and vmstat still seem to be giving me weird values on my system (e.g.
us=1, sy=0, id=16 add up to only 17%), but the sar stats look correct
(percentages add up to 100).

Mike

-----Original Message-----
From: ale-admin at ale.org [mailto:ale-admin at ale.org]On Behalf Of Michael
To: ale at ale.org
D. Hirsch
Sent: Tuesday, January 07, 2003 10:46 AM
To: ale at ale.org
Subject: Re: [ale] Best command for cpu utilization


On Tuesday 07 January 2003 08:50 am, Mike Millson wrote:
> What is the best command to get cpu utilization? When I run iostat or
> vmstat, it shows idle cpu at 14%. When I run top it initially shows idle
> cpu at 5.7%, then changes to 98.0%.
>
> Why does top show a low number initially then quickly display a new
> number that is very different?

I've always assumed it is that top is not very clever.  top refreshes
itself every 5 seconds, so the numbers yuo see are averages over those 5
seconds.  But it doesn't wait 5 seconds to show it's first screen.  So
that screen is not averaged, or not averaged correctly.  I haven't read
the code, but I can imagine all sorts of ways to get bad data.  For
instance, if it counts idle cpu cycles and divides by 5 seconds, even
though it's only been 1 second, you could get the wrong amount of idle
cpu.  Another possibility is that top itself typically chews up around 5%
of the cpu, but that 5% is spread over 5 seconds.  If it uses that same 5%
in a half second, top will be using 50% of the cpu.

I pretty much ignore top until the first time it refreshed.

> Why do top and iostat/vmstat show numbers that are so different?
>
> Why do iostat and vmstat show numbers that don't add up to 100%?

Sorry, can't help you there.  Some would say I wasn't helpful above,
either.

My favorite tool is xosview, though that is a graphical tool.

--Michael

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list