Install Symon / Symux + Syweb on FreeBSD 7.2

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_add -r 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, nic bandwidth, apache and mysql processes and the usage of the hard disk (ad2s1a).

symon.conf
monitor { cpu(0),  mem,
if(em0),
#      pf,
#         mbuf,
#         sensor(0),
proc(httpd),proc(mysqld),
#         if(xl0), if(de0), if(wi0),
#      io(wd1), io(wd2), io(wd3), io(cd0)
io(ad2s1a)
} stream to 127.0.0.1 2100

You can easily monitor pf too, but you have to change permissions to /dev/pf to permit symon read it. In 2 days it become ~18 Mb, so i’ve removed it from the config.

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 localhost cache

Inside “localhost” directory will go rrd files, you can choose what name you want for that dir, only remember that “rrd directory” (in this case “localhost”) must be inside syweb dir ( /usr/local/www/apache24/data/syweb ).
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(em0),
#           pf,
#              mbuf,
#              sensor(0),
proc(httpd),proc(mysqld),
#              if(xl0), if(de0), if(wi0),
#           io(wd1), io(wd2), io(wd3), io(cd0)
io(ad2s1a)
}
datadir “/usr/local/www/apache24/data/syweb/localhost”
}

Now:

cd /usr/local/www/apache24/data/syweb/localhost
and run the script to create the rrd files:
/usr/local/share/symon/c_smrrds.sh all

Now go back to syweb dir and copy the content of htdocs dir there:

cp htdocs/syweb/* .

Open the file setup.inc and edit the FreeBSD section:

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’]=’/usr/local/www/apache24/data/syweb’;
$symon[‘layout_dir’]=’/usr/local/www/apache24/data/syweb’;

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).
Well, it’s done, but we have a little problem with class_layout.inc. To get Syweb working we have to comment a couple of lines in that file, or it will generate an error.
Here:


if (is_file($symon[“host_tree”].”/”.$machine)) {
runtime_error(‘$symon[“host_tree”] should contain machine directories, not files. ($sy
mon[“host_tree”]/cpu0.rrd => $symon[“host_tree”]/localhost/cpu0.rrd)’);
}

Just add /* and */


/*
if (is_file($symon[“host_tree”].”/”.$machine)) {
runtime_error(‘$symon[“host_tree”] should contain machine directories, not files. ($sy
mon[“host_tree”]/cpu0.rrd => $symon[“host_tree”]/localhost/cpu0.rrd)’);
}
*/

Then 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!

20 pensieri riguardo “Install Symon / Symux + Syweb on FreeBSD 7.2”

  1. Yes, to see graphs you have to point your browser to your syweb directory, http://yourdomainoripaddress/whatever/syweb/.
    The directory “locahost” is where .rdd files are located. You can choose whatever name you want for that dir, for example the name of the machine where symon in running.

    I’ve changed in the howto syweb dir from /www/symon/ to /www/syweb, i hope it’s more clear now.

  2. Ok 1 more thing in my case mt rrd files are stored in
    /www/symon/localhost
    assuming the ip address of the machine where i have installed symon is x.x.x.x will the result be

    http://x.x.x.x/www/symon/localhost

    Also when you say “point your browser” how do i do that? Is that form a web browser on another machine or the same machine? Thanks

  3. Hi,
    in a scenario where i am monitoring more than 1 machine with symon installed on all of them, what datadir will i specify for the other monitor statements?

    Also will the system running symux have a mux statement pointing to localhost or its ipaddress?

  4. You should tell symux to listen not only on localhost and add a section for only machine that you want to collect data, for example:

    mux 192.168.10.1 2100

    source 192.168.10.1 {
    accept {
    .. .. ..
    }
    datadir “/usr/local/www/apache22/data/syweb/localhost”
    }

    source 192.168.10.2 {
    accept {
    .. .. ..
    }
    datadir “/usr/local/www/apache22/data/syweb/mailserver”
    }

    source 192.168.10.3 {
    accept {
    .. .. ..
    }
    datadir “/usr/local/www/apache22/data/syweb/webserver”
    }

    This should work..

  5. simplex i am not used to unix but i have installed symon and i ll like to monitor pf.

    you have said this is possible by….
    You can easily monitor pf too, but you have to change permissions to /dev/pf to permit symon read it. In 2 days it become ~18 Mb, so i’ve removed it from the config.

    My question is how do i grant symon the necessary permissions?

  6. hey tanx man, worked, did you also try installing on a linux machine? if you did was it successful? i want to monitor 1 of my systems that runs linux but cant seem to get the symon up on it

  7. I am trying to hear from other machines asper your (a.m.) instructions, replicating the “source…” for each one but no streaming at all.

    in the remote host I started symon only and later started the symon + symux but I have no data flowing from the remote to this (central) host.

    any hint?

    TIA

  8. If your nic have ip 192.168.1.1 (as example) with
    “mux 192.168.1.1 2100”
    in your symux.conf
    and with
    “stream to 192.168.1.1 2100”
    in all symon.conf files, it should work.
    If you see the dataflow, then i can’t imagine what is going wrong..
    Try connecting via telnet from one of the machine running symon, with
    telnet $ip_of_symux $port

  9. Seems ok, except that i don’t see
    “mux 201.54.xxx.yyy”
    on top of symux.conf, but i think there is this line in that file.
    I don’t know why it doesn’t work.
    Are all .rrd files created without problems? What about the permissions?

  10. Hi, Thanks for the how to, but I am getting this error:

    symon: could not get user information for user ‘_symon’: No such file or directory

    when trying to run symon.. any ideas?

    thanks

      1. i created a nologin user and resolved the issue..

        my question is, does it symon have to run every 5s to work? I tried to set it to “every 300 seconds stream to 127.0.0.1” and the graphs stopped working..

        ex:

        # Demo configuration for symon. See symon(8) for BNF.
        #

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

  11. If you want to use another update interval, make sure to set it in both the symon.conf _and_ the .rrd definition.

    Additional hint:
    INTERVAL=300 c_smrrds.sh all

Lascia un commento

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