[hobbit] creating custom graphs in hobbit

Henrik Stoerner henrik at hswn.dk
Tue Sep 27 23:23:17 CEST 2005


On Mon, Sep 26, 2005 at 01:58:37PM -0500, Adam Scheblein wrote:
> 
> Recently i have been trying to create a custom script that grabs cpu 
> utilization percentage, however when i try to get it to graph, it will 
> not work...  I have read the man page for hobbitd_rrd as well as the 
> message thread "custom RRD data" in the hobbit mailing list archives, 
> however i still cannot get it to work.
> 
> Here is my client script:
[snip]
> $BB $BBDISP "status $MACHINE.$TEST $COLOR `date` - $STATUS Used CPU: $USED_CPU"

This sends a one-line status report with the text
green Tue Sep 27 23:11:49 CEST 2005 - ok Used CPU: 15

> Here is my feeder script on the server side:
[snip]
>        # Analyze the message we got
>        cpu2=grep "^OK - " $FNAME | awk '{ print $11 }'

This line looks for "OK" at the beginning of a line (but it is
in the middle of the line, and in lowercase). So it probably won't
find anything, and $cpu2 will be blank.


If you do want to use an extension script for this, I'd suggest
sending in the status message like this:

$BB $BBDISP "status $MACHINE.$TEST $COLOR `date` - $STATUS 
Used CPU: $USED_CPU"

i.e. split it on two lines, and have just the "Used CPU: X"
on a line by itself. Then your feeder script should be

     cpu2=grep "^Used CPU:" $FNAME | awk '{ print $3 }'


However, there's a simpler way of getting the same result.
Assuming you already have the vmstat data - e.g. from the Hobbit
client, or by running the BB client with the LARRD add-on - 
you can leverage those data and generate the same graph by 
changing the [la] graph definition in your hobbitgraph.cfg
to this:

[la]
        TITLE CPU Utilitization
        YAXIS % Used
        -u 100
        -r
        DEF:cpu_idl=vmstat.rrd:cpu_idl:AVERAGE
        CDEF:pbusy=100,cpu_idl,-
        LINE2:pbusy#00CC00:% CPU busy
        GPRINT:pbusy:LAST: \: %5.1lf (cur)
        GPRINT:pbusy:MAX: \: %5.1lf (max)
        GPRINT:pbusy:MIN: \: %5.1lf (min)
        GPRINT:pbusy:AVERAGE: \: %5.1lf (avg)\n

This determines the CPU busy percentage as (100 - idle %).


Regards,
Henrik




More information about the Xymon mailing list