Install Symon / Symux + Syweb on FreeBSD 10.3

NB: this is an old article of mine, revised.

Symon is a useful tool that collect data like cpu/bandwidth/whatever usage and display it with nice graphs, like this for example:

symon_example
First of all, install symon! Since it haven’t configuration options you can use pkg install symon or go to /usr/ports/sysutils/symon and run make install clean.
After a succesful installation, you have to copy your default symon.conf and symux.conf to etc/ directory.
If you have installed symon with the default prefix (/usr/local) you have simply to do
cp /usr/local/share/examples/symon/sym* /usr/local/etc/
Now edit the configuration files, symon.conf and symux.conf.

Here’s my sample configuration for monitor localhost machine, it checks cpu, system memory, load, bandwidth, and the usage of the hard disk (ad0p2).

symon.conf

monitor { cpu(0), mem,
if(igb0),
# mbuf,
# sensor(cpu0.temp0),
# proc(httpd),
# if(xl0), if(de0), if(wi0),
# io(wd1), io(wd2), io(wd3), io(cd0)
io(ada0p2)
} stream to 127.0.0.1 2100

Symux.conf it’s the same, except for the first line that tell symux where it have to connect, and the last line, “datadir”, the place for .rrd files.
I assume that you have PHP and Apache (or another web server) installed and working. Just for give an example, i will use Apache default directory for www files,

/usr/local/www/apache24/data

Inside this dir we will install syweb, under a subdirectory called….syweb! Then do


cd /usr/local/www/apache24/data
wget http://www.xs4all.nl/~wpd/symon/philes/syweb-0.58.tar.gz
tar zxvf syweb-0.58.tar.gz
cd syweb
mkdir cache

I will put the rrd files here

mkdir -p /var/db/symon/localhost
chown -R www:www /var/db/symon/

The rrd files will go inside “localhost” directory, set the permission to the webserver user, so it can read it.
Let’s see what we have to put in symux.conf:

symux.conf

mux 127.0.0.1 2100

source 127.0.0.1 {
accept { cpu(0),  mem,
if(igb0),
#        mbuf,
#        sensor(0),
#        if(xl0), if(de0), if(wi0),
#        io(wd1), io(wd2), io(wd3), io(cd0)
io(ada0p2)
}
datadir “/var/db/symon/localhost”
}

Now:

cd /var/db/symon/localhost

and run the script to create the rrd files:

/usr/local/share/symon/c_smrrds.sh all

Now go back to syweb dir, inside htdocs:

cd /usr/local/www/apache24/data/syweb/htdocs/syweb

Open the file setup.inc, comment out the Linux section and edit the FreeBSD one:

FreeBSD section of setup.inc

/* running FreeBSD, apache not chrooted: */
$symon[‘rrdtool_path’]=’/usr/local/bin/rrdtool’;
$symon[‘cache_dir’]=’/usr/local/www/apache24/data/syweb/cache’;
$symon[‘host_tree’]=’/var/db/symon’;
$symon[‘layout_dir’]=’/usr/local/www/apache24/data/syweb/symon’;

Note that you don’t need to put “localhost” on the host_tree variable.
Change the perms of syweb dir to www:www :

chown -R www:www /usr/local/www/apache24/data/syweb

As written in symux.conf, symux will look for .rrd files in $host_tree/localhost ( must be the same of datadir in symux.conf).

Now you can add
symon_enable=”YES”
symux_enable=”YES”

in your /etc/rc.conf file to have symon/symux started at boot (i suggest to use /etc/rc.conf.local instead of /etc/rc.conf).
Start symon and symux with
/usr/local/etc/rc.d/symon start
/usr/local/etc/rc.d/symux start
point your browser to your syweb dir (in our case http://127.0.0.1/syweb) and watch the graphs grow!
That’s all, enjoy!

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *