hobbit-confreport.cgi syntax
list Thomas Pedersen
What's the syntax for hobbit-confreport.cgi ? /thomas
list Henrik Størner
On Wed, Sep 21, 2005 at 04:25:53PM +0200, Thomas wrote:
What's the syntax for hobbit-confreport.cgi ?
It's invoked as a CGI script. I noticed now that the normal ".sh" wrapper script wasn't included in 4.1.1 - fixed that. A simple script like this in cgi-bin/hobbit-confreport.sh: #!/bin/sh exec /usr/lib/hobbit/server/bin/hobbit-confreport.cgi --env=/etc/hobbit/hobbitserver.cfg And then you should be able to run it by picking it from the "Reports" menu. It uses a cookie to determine what pages/hosts to include in the report. Henrik
list Thomas Pedersen
How do I change what hosts to include in den report ? BR Thomas
▸
Henrik Stoerner wrote:
On Wed, Sep 21, 2005 at 04:25:53PM +0200, Thomas wrote:What's the syntax for hobbit-confreport.cgi ?It's invoked as a CGI script. I noticed now that the normal ".sh" wrapper script wasn't included in 4.1.1 - fixed that. A simple script like this in cgi-bin/hobbit-confreport.sh: #!/bin/sh exec /usr/lib/hobbit/server/bin/hobbit-confreport.cgi --env=/etc/hobbit/hobbitserver.cfg And then you should be able to run it by picking it from the "Reports" menu. It uses a cookie to determine what pages/hosts to include in the report. Henrik
list Francesco Duranti
If i use the config report from a page inside a pageset it work well but if i use it from the first page of a pagesets it will report all the configured object and not only those in the pageset. Francesco -----Messaggio originale----- Da: Henrik Stoerner [mailto:user-ce4a2c883f75@xymon.invalid] Inviato: mercoledì 21 settembre 2005 17.12 A: user-ae9b8668bcde@xymon.invalid Oggetto: Re: [hobbit] hobbit-confreport.cgi syntax
▸
On Wed, Sep 21, 2005 at 04:25:53PM +0200, Thomas wrote:What's the syntax for hobbit-confreport.cgi ?
It's invoked as a CGI script. I noticed now that the normal ".sh" wrapper script wasn't included in 4.1.1 - fixed that. A simple script like this in cgi-bin/hobbit-confreport.sh: #!/bin/sh exec /usr/lib/hobbit/server/bin/hobbit-confreport.cgi --env=/etc/hobbit/hobbitserver.cfg And then you should be able to run it by picking it from the "Reports" menu. It uses a cookie to determine what pages/hosts to include in the report. Henrik
list Francesco Duranti
A correction to this: with pageset the config report script will not work I think. It work for the page I've also in the main bb files but if I have a page in the pageset not present in the main BB file it will not work. The output of config report in this case is a web page with: Unable to find host information Francesco -----Messaggio originale----- Da: Francesco Duranti [mailto:user-7104dcecbfef@xymon.invalid] Inviato: lunedì 26 settembre 2005 11.58 A: user-ae9b8668bcde@xymon.invalid Oggetto: [hobbit] R: [hobbit] hobbit-confreport.cgi syntax
▸
If i use the config report from a page inside a pageset it work well but if i use it from the first page of a pagesets it will report all the configured object and not only those in the pageset.
Francesco
-----Messaggio originale-----
▸
Da: Henrik Stoerner [mailto:user-ce4a2c883f75@xymon.invalid]
Inviato: mercoledì 21 settembre 2005 17.12
A: user-ae9b8668bcde@xymon.invalid
Oggetto: Re: [hobbit] hobbit-confreport.cgi syntax
On Wed, Sep 21, 2005 at 04:25:53PM +0200, Thomas wrote:What's the syntax for hobbit-confreport.cgi ?
It's invoked as a CGI script. I noticed now that the normal ".sh" wrapper script wasn't included in 4.1.1 - fixed that. A simple script like this in cgi-bin/hobbit-confreport.sh: #!/bin/sh exec /usr/lib/hobbit/server/bin/hobbit-confreport.cgi --env=/etc/hobbit/hobbitserver.cfg And then you should be able to run it by picking it from the "Reports" menu. It uses a cookie to determine what pages/hosts to include in the report. Henrik
list Adam Scheblein
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
list Henrik Størner
▸
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
list Adam Scheblein
So i took your simpler way of getting the graph, however then i realized that the alerts that were being generated were still based on load -- is there any way to configure hobbit to turn red/yellow based on cpu utilization % rather than load? thanks again for all your help, your dedication to OSS is inspiring! Adam
▸
Henrik Stoerner wrote:
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: 15Here 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