mnemonic technology

Unix System Monitoring with Symon, Symux and Syweb

June 30th, 2008 by mnology

Syweb is an all in one package for displaying RRDtool data collected via Symon and Symux. These tools collect helpful data such has CPU usage, disk I/O usage and process resource usage. The screenshot shows the various devices and processes that I've decided I would like to monitor. As you can see it provides an at a glance view of resource usage on your server.

Let's start off by building and installing all three(Symon, Symux & Syweb). You can do this using your systems package manager or building from source. I'll be installing from OpenBSD's ports system.

Symux is the collection agent for the data generated by Symon and needs to be configured and running before we start Symon. However, Symon includes a script for scanning your system for devices to generate data on and creates a Symon configuration file. It's a bit of chicken-and-egg issue.

Now we'll execute the script for the Symon config so we have a basis of what our Symux config is going to look like. Locate c_config.sh script installed by the Symon package. In my installation it is located at /usr/local/share/symon/c_config.sh. Redirect the output from this script to /etc/symon.conf to start with. Modify this file to fine-tune what to generate data on depending on your system and monitoring requirements.

Example /etc/symon.conf:

monitor {
   cpu(0), cpu(1), mem,
   io(wd0),
   if(lo0), if(dc0), if(dc1),
   mbuf,
   pf,
   proc(httpd2), proc(mysqld), proc(squid),
   sensor(acpitz0.temp0), sensor(admtemp0.temp0),
   sensor(it0.fan0), sensor(it0.fan1)
}
 
stream to 127.0.0.1 2100

Now that we know what devices we're going to be generating data for, we can configure the Symux collection service. The main difference to note here is where the collected data is going to end up and what IP address and port the service is going to be listening on.

Example: /etc/symux.conf

mux 127.0.0.1 2100
source 127.0.0.1 {
  accept {
    cpu(0), cpu(1), mem,
    io(wd0),
    if(lo0), if(dc0), if(dc1),
    mbuf,
    pf,
    proc(httpd2), proc(mysqld), proc(squid),
    sensor(acpitz0.temp0), sensor(admtemp0.temp0),
    sensor(it0.fan0), sensor(it0.fan1)
  }
 
  datadir "/var/data/symon/rrds/localhost"
}

Great! Now the data collection and reporting services are configured. Now that we have Symux configured we can use the provided /usr/local/share/symon/c_smrrds.sh (OpenBSD) script to generate the RRD files for the devices & processes we configured in Symux. Without generating the RRDs no data will be collected and starting the services will fail.

We are now ready to start the Symux & Symon services. You must start Symux first so Symon has a place to send data to. This should be as simple as:

# /usr/local/libexec/symux
# /usr/local/libexec/symon

Don't forget to add these to your platforms start-up scripts. On OpenBSD we use /etc/rc.local

if [ -x /usr/local/libexec/symux ]; then
  echo -n ' symux';
  /usr/local/libexec/symux
fi
 
if [ -x /usr/local/libexec/symon ]; then
  echo -n ' symon';
  /usr/local/libexec/symon
fi

Perfect! Okay, now that we're collecting all this data let's look at it with Syweb. Syweb installation can be as easy as unpacking the tarball from the download directory and moving the syweb/htdocs/syweb directory to your web servers DocumentRoot. You will also need to move the .layout files located under the extracted directory syweb/symon to the layout_dir directory you specify in the Syweb setup file below.

After extracting and moving Syweb to your web servers document root(/var/apache2/htdocs/syweb) we'll want to modify Syweb's configuration to tell it where our RRDs(created by Symon & Symux) are located and where the rrdtool binary is located. This is done by modifying the setup.inc file included in the Syweb directory.

Example /var/apache2/htdocs/syweb/setup.inc:

/* running OpenBSD, apache not chrooted: */
$symon['rrdtool_path']='/usr/local/bin/rrdtool';
$symon['cache_dir']='/var/data/symon/cache';
$symon['host_tree']='/var/data/symon/rrds';
$symon['layout_dir']='/var/data/symon';

Congratulations! You should now be seeing graphs for collected Symon data by browsing to http://localhost/syweb. If you wish to modify the reports look at the .layout files in the layout_dir.

For my configuration I have a virtual host(http://syweb.domain.com) configured for this service. Whether or not you can do this depends on what type of access you have to your webservers configuration.

Tags:   · · · · · · 7 Comments

Leave A Comment

This site is using OpenAvatar based on

7 responses so far ↓

  • 1 nycveloNo Gravatar Jul 21, 2008 at 7:55 pm

    nice post, thanks.

    How to use symon / symux / syweb to collected detailed pf stats? I’m looking for a sample config for the various pf stats given in the pfmux manpage.

    thanks

  • 2 mnologyNo Gravatar Jul 22, 2008 at 11:14 am

    I’m not quite sure what pfmux is and Google is coming up blank. You probably want to modify the pf.layout file that came with syweb. Using my provided configuration files you’ll notice I’m already collecting data for the pf interface.

    Chances are you don’t have the same network interfaces that the developer does. Change the names of the RRD files in that file to reflect your interface RRD files and then replace all instances of xl0 and dc0 with your respective internal/external device names.

    You should then be able to use the dropdown in the syweb interface to change from ‘default’ to ‘pf’.

  • 3 badguyNo Gravatar Jun 30, 2009 at 2:12 pm

    hi, thanks for this, very helpful.

    i got stuck at this point.

    “Now that we have Symux configured we can use the provided /usr/local/share/symon/c_smrrds.sh (OpenBSD) script to generate the RRD files for the devices & processes we configured in Symux. Without generating the RRDs no data will be collected and starting the services will fail.”

    how do i generate the rrd files? what do i have to modify on the script for this to occur?
    thanks

  • 4 mnologyNo Gravatar Jul 5, 2009 at 11:43 am

    The c_smrrds.sh script will generate the RRD’s for you. You need not change anything in the script. The script uses the configuration in symux.conf to determine which devices it will generate RRD’s for and where the RRD’s will be placed(the datadir directive).

  • 5 badguyNo Gravatar Jul 7, 2009 at 10:53 am

    ok thanks im almost there. lol

    my last problem is viewing the graphs with syweb
    i.e.
    “Congratulations! You should now be seeing graphs for collected Symon data by browsing to http://localhost/syweb. If you wish to modify the reports look at the .layout files in the layout_dir”

    My questions are how do i browse to the files? do i do this form a web browser of another system or from the same system i have installed symon ? i have my rrd files located in /www/symon/localhost and the ip address of the machine is 10.1010.10. how do i browse to view th files?

  • 6 Ccie009No Gravatar Jul 23, 2009 at 2:56 pm

    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?

  • 7 mnologyNo Gravatar Oct 11, 2009 at 3:40 pm

    @ccie09: For multiple hosts it would require a new “source” entry for each host in symux.conf. You can specify different datadirs in each source entry. This would probably also require tweaking of the .layout files to bring in these different datadirs if you are using symon as well.

    For the symux system accepting data from other hosts you need to change the mux line in symux.conf to an external interface( not localhost ). After you do that you would also have to configure the source line for the host you are running symux on via it’s external address because symux would no longer be accepting connections on the localhost device. Or you could have 2 mux entries and point the source entry for the machine that symux is to localhost. Whichever method your environment requires.