creating custom graphs in hobbit

Adam Scheblein adam.scheblein at marquette.edu
Mon Sep 26 20:58:37 CEST 2005


Greetings,

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:
#!/usr/bin/bash
BBPROG=bb-cpu2.sh; export BBPROG

TEST="cpu2"

if test "$BBHOME" = ""
then
        echo "BBHOME is not set... exiting"
        exit 1
fi

if test ! "$BBTMP"                      # GET DEFINITIONS IF NEEDED
then
         # echo "*** LOADING BBDEF ***"
        . $BBHOME/etc/bbdef.sh          # INCLUDE STANDARD DEFINITIONS
fi

#
# NOW COLLECT SOME DATA

TOTAL_IDLE_CPU=`vmstat 1 5 |tail -n 4 | awk '{ print $18 }'| perl -ne 
'$cnt+= $_; print "$cnt \n"' |tail -n 1| perl -ne '$cnt+= $_; print $cnt'`
IDLE_CPU=`$EXPR $TOTAL_IDLE_CPU / 4`
USED_CPU=`$EXPR 100 - $IDLE_CPU`

if [ $USED_CPU -ge "75" ]
then
  if [ $USED_CPU -lt 90 ]
  then
        COLOR="yellow"
        GIFCOLOR="&yellow"
        STATUS="warn"
  else
        COLOR="red"
        GIFCOLOR="&red"
        STATUS="panic"
  fi
else
  COLOR="green"
  GIFCOLOR="&green"
  STATUS="ok"
fi

#
# AT THIS POINT WE HAVE OUR RESULTS.  NOW WE HAVE TO SEND IT TO
# THE BBDISPLAY TO BE DISPLAYED...
#
$BB $BBDISP "status $MACHINE.$TEST $COLOR `date` - $STATUS Used CPU: 
$USED_CPU"

Here is my feeder script on the server side:
#!/bin/sh

# Input parameters: Hostname, testname (column), and messagefile
HOSTNAME="$!"
TESTNAME="$2"
FNAME="$3"

#CPU2

if [ "$TESTNAME" = "cpu2" ]
then
        # Analyze the message we got
        cpu2=grep "^OK - " $FNAME | awk '{ print $11 }'

       # The RRD dataset definitions
        echo "DS:cpu2:GAUGE:600:0:100"

        # The filename
        echo "cpu2.rrd"

        # The data
        echo "$cpu2"
fi

exit 0

i also edited the following lines in the following files:
hobbitgraph.cfg
[cpu2]
        TITLE CPU Utilization Percentage
        YAXIS Percentage
        DEF:cpu2=cpu2.rrd:cpu2:AVERAGE
        LINE2:cpu2#00CCCC:CPU Utilization
        COMMENT:\n
        GPRINT:cpu2:LAST: \: %5.1lf (cur)
        GPRINT:cpu2:MAX: \: %5.1lf (max)
        GPRINT:cpu2:MIN: \: %5.1lf (min)
        GPRINT:cpu2:AVERAGE: \: %5.1lf (avg)\n

hobbitlaunch.cfg
[rrdstatus]
        ENVFILE /usr/local/hobbit/server/etc/hobbitserver.cfg
        NEEDS hobbitd
        CMD hobbitd_channel --channel=status 
--log=$BBSERVERLOGS/rrd-status.log hobbitd_rrd --rrddir=$BBVAR/rrd 
--extra-script=/usr/local/hobbit/server/ext/cpu2.sh --extra-test=cpu2

[rrddata]
        ENVFILE /usr/local/hobbit/server/etc/hobbitserver.cfg
        NEEDS hobbitd
        CMD hobbitd_channel --channel=data   
--log=$BBSERVERLOGS/rrd-data.log hobbitd_rrd --rrddir=$BBVAR/rrd 
--extra-script=/usr/local/hobbit/server/ext/cpu2.sh --extra-test=cpu2

hobbitserver.cfg
TEST2RRD="cpu=la,cpu2,disk,inode,qtree,memory,$PINGCOLUMN=tcp,http=tcp,dns=tcp,dig=tcp,time=ntpstat,vmstat,iostat,netstat,temperature,apache,bind,sendmail,mailq,nmailq=mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd" 


GRAPHS="la,cpu2,disk,inode,qtree,memory,users,vmstat,iostat,tcp.http,tcp,netstat,mrtg::1,temperature,ntpstat,apache,bind,sendmail,mailq,socks,bea,iishealth,citrix,bbgen,bbtest,bbproxy,hobbitd"

And then i have restarted the Hobbit server multiple times since then 
and Hobbit says "Hobbit cpu2 graph" however, the server piece never 
seems to create the rrd file.

Any ideas??

thanks,
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20050926/abbb897b/attachment.html>


More information about the Xymon mailing list