How to setup hobbit/xymon, including MySQL graphs

Updated 2011-06-20 – updated for ‘xymon’

Setting up xymon client

adduser --disabled-login xymon
cd /usr/src
wget http://downloads.sourceforge.net/project/xymon/Xymon/4.3.3/xymon-4.3.3.tar.gz
tar -zxvf xymon-4.3.3.tar.gz
cd xymon-4.3.3
./configure.client

(config=server)
(user=xymon)
(home=/home/xymon)

make
make install
su - xymon -c "/home/xymon/client/runclient.sh start"

Install MySQL/Apache Montioring on client

1. Create a mysql user ‘monitoring’, eg:

CREATE USER 'monitoring'@'localhost' IDENTIFIED BY 'monitoring';

2. Install ext scripts::

cd /home/xymon/client
svn co http://svn.websys.nz/xymon-ext/trunk ext
chown xymon:xymon ext -R
chmod 700 ext -R

Set mysql password in the file:

bb-mysql.pl

Edit disk device in the files:

diskreads.sh
diskwrites.sh

Add lines to /home/xymon/client/etc/clientlaunch.cfg
(or on server, put them in /home/xymon/server/etc/tasks.cfg and replace XYMONCLIENTHOME with server dirs)

[mysql]
ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/bb-mysql.pl
LOGFILE $XYMONCLIENTLOGS/logs/bb-mysql.log
INTERVAL 5m

[mysqlhq]
ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/mysqlhq
LOGFILE $XYMONCLIENTLOGS/logs/mysqlhq.log
INTERVAL 5m

[mysqlht]
ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/mysqlht
LOGFILE $XYMONCLIENTLOGS/logs/mysqlht.log
INTERVAL 5m

[mysqlhs]
ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/mysqlhs
LOGFILE $XYMONCLIENTLOGS/logs/mysqlhs.log
INTERVAL 5m

[apachew]
ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/apache-workers.sh
LOGFILE $XYMONCLIENTLOGS/logs/apache-workers.log
INTERVAL 5m

[diskreads]
ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/diskreads.sh
LOGFILE $XYMONCLIENTLOGS/logs/diskreads.log
INTERVAL 5m

[diskwrites]
ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/diskwrites.sh
LOGFILE $XYMONCLIENTLOGS/logs/diskwrites.log
INTERVAL 5m

[coretemp]
ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
CMD $XYMONCLIENTHOME/ext/coretemp.pl
LOGFILE $XYMONCLIENTLOGS/logs/coretemp.log
INTERVAL 5m

restart xymon:

su -c "/home/xymon/client/runclient.sh start" xymon

Setting up xymon server

Add to settings in /home/xymon/server/etc/xymonserver.cfg

TEST2RRD="EXISTING_STUFF,apachew=ncv,mysqlht=ncv,mysqlhs=ncv,mysqlhq=ncv,diskreads=ncv,diskwrites=ncv,coretemp=ncv"

GRAPHS="EXISTING_STUFF,apachew,mysqlhq,mysqlht,mysqlhs,diskreads,diskwrites,coretemp"

NCV_apachew="numworkers:GAUGE"
NCV_mysqlht="numthreads:GAUGE"
NCV_mysqlhs="slowqueries:GAUGE"
NCV_mysqlhq="queriespersec:GAUGE"
NCV_diskreads="diskreads:GAUGE"
NCV_diskwrites="diskwrites:GAUGE"
NCV_coretemp="core0:GAUGE,core1:GAUGE,core2:GAUGE,core3:GAUGE"

add sections to /home/xymon/server/etc/graphs.cfg

[apachew]
TITLE Apache Workers
YAXIS Num
DEF:workers=apachew.rrd:numworkers:AVERAGE
LINE2:workers#00CCCC:Apache workers
COMMENT:\n
GPRINT:workers:LAST:Apache workers \: %5.1lf%s (cur)
GPRINT:workers:MAX: \: %5.1lf%s (max)
GPRINT:workers:MIN: \: %5.1lf%s (min)
GPRINT:workers:AVERAGE: \: %5.1lf%s (avg)\n

[mysqlht]
TITLE MySQL Threads
YAXIS Num
DEF:threads=mysqlht.rrd:numthreads:AVERAGE
LINE2:threads#00CCCC:MySQL threads
COMMENT:\n
GPRINT:threads:LAST:MySQL threads \: %5.1lf%s (cur)
GPRINT:threads:MAX: \: %5.1lf%s (max)
GPRINT:threads:MIN: \: %5.1lf%s (min)
GPRINT:threads:AVERAGE: \: %5.1lf%s (avg)\n

[mysqlhs]
TITLE MySQL Slow Queries
YAXIS Num
DEF:slow=mysqlhs.rrd:slowqueries:AVERAGE
LINE2:slow#ff0000:Slow queries
COMMENT:\n
GPRINT:slow:LAST:Slow queries \: %5.1lf%s (cur)
GPRINT:slow:MAX: \: %5.1lf%s (max)
GPRINT:slow:MIN: \: %5.1lf%s (min)
GPRINT:slow:AVERAGE: \: %5.1lf%s (avg)\n

[mysqlhq]
TITLE MySQL Queries Per Second
YAXIS Num
DEF:qps=mysqlhq.rrd:queriespersec:AVERAGE
LINE2:qps#ff0000:Queries per sec
COMMENT:\n
GPRINT:qps:LAST:Queries per sec \: %5.1lf%s (cur)
GPRINT:qps:MAX: \: %5.1lf%s (max)
GPRINT:qps:MIN: \: %5.1lf%s (min)
GPRINT:qps:AVERAGE: \: %5.1lf%s (avg)\n

[diskreads]
TITLE Disk reads
YAXIS Num
DEF:diskreads=diskreads.rrd:diskreads:AVERAGE
LINE2:diskreads#00CCCC:Disk reads
COMMENT:\n
GPRINT:diskreads:LAST:Disk reads\: %5.1lf%s (cur)
GPRINT:diskreads:MAX: \: %5.1lf%s (max)
GPRINT:diskreads:MIN: \: %5.1lf%s (min)
GPRINT:diskreads:AVERAGE: \: %5.1lf%s (avg)\n

[diskwrites]
TITLE Disk writes
YAXIS Num
DEF:diskwrites=diskwrites.rrd:diskwrites:AVERAGE
LINE2:diskwrites#00CCCC:Disk writes
COMMENT:\n
GPRINT:diskwrites:LAST:Disk writes \: %5.1lf%s (cur)
GPRINT:diskwrites:MAX: \: %5.1lf%s (max)
GPRINT:diskwrites:MIN: \: %5.1lf%s (min)
GPRINT:diskwrites:AVERAGE: \: %5.1lf%s (avg)\n

[coretemp]
TITLE Core Temperature
YAXIS Degrees C
DEF:core0=coretemp.rrd:core0:AVERAGE
DEF:core1=coretemp.rrd:core1:AVERAGE
DEF:core2=coretemp.rrd:core2:AVERAGE
DEF:core3=coretemp.rrd:core3:AVERAGE
LINE2:core0#FF0000:Core 0
LINE2:core1#00FF00:Core 1
LINE2:core2#0000FF:Core 2
LINE2:core3#FF66BB:Core 3
COMMENT:\n
GPRINT:core0:LAST:Core 0 \: %3.1lf%s (cur)
GPRINT:core0:MAX: \: %3.1lf%s (max)
GPRINT:core0:MIN: \: %3.1lf%s (min)
GPRINT:core0:AVERAGE: \: %3.1lf%s (avg)\n
GPRINT:core1:LAST:Core 1 \: %3.1lf%s (cur)
GPRINT:core1:MAX: \: %3.1lf%s (max)
GPRINT:core1:MIN: \: %3.1lf%s (min)
GPRINT:core1:AVERAGE: \: %3.1lf%s (avg)\n
GPRINT:core2:LAST:Core 2 \: %3.1lf%s (cur)
GPRINT:core2:MAX: \: %3.1lf%s (max)
GPRINT:core2:MIN: \: %3.1lf%s (min)
GPRINT:core2:AVERAGE: \: %3.1lf%s (avg)\n
GPRINT:core3:LAST:Core 3 \: %3.1lf%s (cur)
GPRINT:core3:MAX: \: %3.1lf%s (max)
GPRINT:core3:MIN: \: %3.1lf%s (min)
GPRINT:core3:AVERAGE: \: %3.1lf%s (avg)\n