Xymon Mailing List Archive search

sar & cpu-utilization graph

3 messages in this thread

list Jeff Newman · Mon, 5 Dec 2005 14:37:18 -0600 ·
Hi,

My boss wants the cpu-utilization graph to reflect the statistics on a per
cpu basis.
Investigating, I see that sar can do this, while reporting similar data to
vmstat (i.e. User, System Idle, average etc...) with
the addition of a cpu number. Output:

stlqrma:root:/> sar -P ALL 1 2

AIX stlqrma 3 5 00CB5A2F4C00    12/05/05

System configuration: lcpu=16

15:31:05 cpu    %usr    %sys    %wio   %idle   physc
15:31:06  0       35       5       0      60    0.75
          1        0       0       0     100    0.25
          2       36       5       0      59    0.75
          3        0       0       0     100    0.25
<snip>
15:31:07  0       36       7       0      57    0.77
          1        0       0       0     100    0.24
          2       41       5       0      55    0.77
          3        0       0       0     100    0.23
<snip>
Average   0       36       6       0      59    0.76
          1        0       0       0     100    0.24
          2       39       5       0      57    0.76
          3        0       0       0     100    0.24
<snip>

What is the easiest way to change the cpu utilization graph in hobbit to
take advantage
of this? One small obstacle I see is that the sar output is *slightly*
different on say, linux and aix:

# sar -P ALL 1 1
Linux 2.6.9-5.ELsmp (rp-ladmin)         12/05/2005

02:34:00 PM       CPU     %user     %nice   %system   %iowait     %idle
02:34:01 PM       all      0.00      0.00      0.00      0.00    100.00
02:34:01 PM         0      0.00      0.00      0.00      0.00    100.00
02:34:01 PM         1      0.00      0.00      0.00      0.00    100.00

Same data, with the exception of adding "ALL" and spelling out user/system
etc..

It's one of those things that's either more complicated than it looks, or
easier than I think :-)

Thanks,
Jeff
list Henrik Størner · Mon, 5 Dec 2005 22:54:55 +0100 ·
quoted from Jeff Newman
On Mon, Dec 05, 2005 at 02:37:18PM -0600, Jeff Newman wrote:
My boss wants the cpu-utilization graph to reflect the statistics on a per
cpu basis.
Investigating, I see that sar can do this, while reporting similar data to
vmstat (i.e. User, System Idle, average etc...) with
the addition of a cpu number. Output:
[snip]
What is the easiest way to change the cpu utilization graph in hobbit to
take advantage of this?

It's one of those things that's either more complicated than it looks, or
easier than I think :-)
"The devil is in the detail" ... but it really comes down to the same
issue as when you want to build graphs from some custom test you are
running.

Your boxes should send in the "sar" data using a "data" or "status"
message. If you use a "status" message, you have the benefit (for
debugging) of having the raw data visible on your Hobbit display.
So use a custom column-name, like "sardata" or something unique.

Then you'll have to write a script to interpret these data, and save
them in an RRD file. The hobbitd_rrd tool does this for the standard
data, but you'll have to write your own module to interpret the data
from sar, and save it to one or more RRD files - see the hobbitd_rrd
man-page, the "Custom RRD data via scripts" section. You probably have
a varying number of CPU's in each box, so I'd suggest using one RRD file
for each CPU, and collecting the user/system/idle average for each CPU.
Then you can name the RRD files "sar.[cpu number].rrd".

Finally, build a graph definition in hobbitgraph.cfg to generate a graph
from the RRD files; look at one of the existing definitions and it
should be fairly doable. E.g. use the "la1-multi" definition as a
template for building a "sarcpu" graph definition.


Henrik
list Galen Johnson · Wed, 07 Dec 2005 08:10:31 -0500 ·
quoted from Henrik Størner
Henrik Stoerner wrote:
On Mon, Dec 05, 2005 at 02:37:18PM -0600, Jeff Newman wrote:
 
My boss wants the cpu-utilization graph to reflect the statistics on a per
cpu basis.
Investigating, I see that sar can do this, while reporting similar data to
vmstat (i.e. User, System Idle, average etc...) with
the addition of a cpu number. Output:
   
[snip]
 
What is the easiest way to change the cpu utilization graph in hobbit to
take advantage of this?

It's one of those things that's either more complicated than it looks, or
easier than I think :-)
   
"The devil is in the detail" ... but it really comes down to the same
issue as when you want to build graphs from some custom test you are
running.

Your boxes should send in the "sar" data using a "data" or "status"
message. If you use a "status" message, you have the benefit (for
debugging) of having the raw data visible on your Hobbit display.
So use a custom column-name, like "sardata" or something unique.

Then you'll have to write a script to interpret these data, and save
them in an RRD file. The hobbitd_rrd tool does this for the standard
data, but you'll have to write your own module to interpret the data
from sar, and save it to one or more RRD files - see the hobbitd_rrd
man-page, the "Custom RRD data via scripts" section. You probably have
a varying number of CPU's in each box, so I'd suggest using one RRD file
for each CPU, and collecting the user/system/idle average for each CPU.
Then you can name the RRD files "sar.[cpu number].rrd".

Finally, build a graph definition in hobbitgraph.cfg to generate a graph
from the RRD files; look at one of the existing definitions and it
should be fairly doable. E.g. use the "la1-multi" definition as a
template for building a "sarcpu" graph definition.


Henrik

Have you tried running the sar script on deadcat.net against hobbit?  I
haven't tried it with Hobbit yet myself but it's definitely on my todo
list.  It's one of the more functional tests for Big Bro out there.  It
has some minor issues but works great otherwise (if you have a lot of
partitions on your disks the disk graphs get a bit cluttered...)

=G=