SysStat Charts Homepage

Latest Version: 1.0.0_beta4

If you want to be informed about new releases, press the Monitor link (envelope icon) at File section or click at this direct link.

I've created this tool because I need to know how machines we own or care for are performing. I didn't find anything suitable for my needs (basic charts, easy to use, web access to charts and active development). I placed this project on SourceForge.Net with hope that it might help somebody else too.

What SysStat Charts Does

SysStat Charts collects data from single computer or from several computers, stores the data in database and generates charts and HTML pages for presentation from the data stored in the database. You can collect data from several computers and present the data for all the computers at a single site where you have a web server running.

Because pictures tell more than words (and this is the purpose of this tool), you can see how the output looks here.

How the Program Works

Here are the basic steps that the program does:

  1. dumps data from SysStat to dump files
  2. loads the data into database
  3. creates charts

I will explain each step in detail in the next paragraphs.

Dumping the Data

To generate charts, we need to collect data from machines we are interested in, so we have to configure the machines to give us the data we need.

First thing you have to do is that you have to install SysStat tools and configure it to collect data. For data collection, I set in /etc/crontab this task:

* * * * * root /usr/lib/sa/sa1

This runs sa1 (stats collector) script every minute. sa1 script stores the data into SysStat data file. You can change the crontab row to store the data at interval that is suitable for your needs.

Because SysStat Charts doesn't work directly with the binary data files SysStat creates, we have to dump the data into text files that SysStat Charts can work with. I do it with this command at the directory where I have my SysStat Charts unpacked:

LC_ALL="C" java -jar sysstatcharts.jar dump

LC_ALL="C" ensures that the data will be saved in format that SysStat Charts understands.

Before you run this command, you have to set the target path for your dump files in the sysstatcharts.properties file. I use this setting:

sysstat_dump_path=/root/sysstatcharts/local_dump/

To have the data collected each 15 minutes, I added this task to /etc/crontab:

14,29,44,59 * * * * root /root/sysstatcharts/run

I collect the data on the other servers (not the one where the charts are presented) one minute before each quarter to have the data prepared when the main script runs at the main server.

Here is my 'run' script:

#!/bin/bash
source /etc/profile
cd /root/sysstatcharts
LC_ALL="C" java -jar sysstatcharts.jar dump

I include 'source /etc/profile' to load JAVA_HOME path.

It is important to have the FQDN (fully qualified domain name) set correctly for each machine bacause it is used to name the dump files. You also have to have your time set correctly to receive correct results. For our server the files are named:

titan.startnet.cz_cpu_20060405.dump
titan.startnet.cz_memory_20060405.dump
titan.startnet.cz_network_20060405.dump

So at this moment we have each machine set to dump the system data into dump files each 15 minutes. In the next step we will load the data into database.

Loading Data into Database

SysStat Charts uses PostgreSQL database server to store the data so before you can load data into the database, you have to set up the database server and the database itself.

There is a default settings for access to the PostgreSQL database in the sysstatcharts.properties file:

pg_jdbc_url=jdbc:postgresql://localhost/sysstatcharts?user=sysstatcharts&password=sysstatchartspwd1234

This means that the database is located at 'localhost', its name is 'sysstatcharts', user name is 'sysstatcharts' too and user's password is 'sysstatchartspwd1234'. You can change these values in the properties files and set the database accordingly.

Before we load the dump files into the database, we have to set the path from where the program should read the dumps:

sysstat_load_path=/root/

As you can see, I didn't use the path where the dump files were stored. There is a reason for this. After SysStat Charts loads dump file into database, it removes the file. But when dumping files, SysStat Charts needs the original dump files to generate correctly dump files after midnight (so you have the data from previous day till midnight).

Now we can load the data to the database. You can either load the data directly to the database server or copy the dump files to the server where the database server is running and then load the data at once. In my configuration I use the second approach. I use 'scp' to copy data from each server to the server where I have the database server running but any other tool (ftp etc.) can be used to copy the dump files. To load the data into database, run this command:

java -jar sysstatcharts.jar load

After this command finishes, you have the data from your machines stored in the database. In the next step we will finally generate the charts.

Generating the Charts

Before we generate the charts, we have to set the path in the properties file where we want to have the HTML files stored:

sysstat_charts_path=/var/www/sysstat.startnet.cz/htdocs/

Then we run this command to generate the charts:

java -jar sysstatcharts.jar charts

Now we can direct our browser to our web server and see the charts.

To automate the steps at the main server, I use this script:

#!/bin/bash
source /etc/profile
cd /root/sysstatcharts/

# Dump data for the main server
LC_ALL="C" java -jar sysstatcharts.jar dump

# Copy local dump files to the path from where we load them into database
cp /root/sysstatcharts/local_dump/*.dump /root/sysstatcharts/

# Copy dump files from other machine
scp sysstatcharts@192.168.1.1:~/*.dump /root/sysstatcharts

java -jar sysstatcharts.jar load
java -jar sysstatcharts.jar charts

I run this script from my /etc/crontab file at the main server:

*/15 * * * * root /root/sysstatcharts/run

If you followed the steps above, you should now have SysStat Charts setup and working.

Notes on SysStat Versions

I run SysStat Charts with SysStat 5.0.5 and 6.0.1. It will probably work with other versions too if the format of the data is the same and parameters that SysStat Charts uses are supported.

Bugs

If you find a bug, you can either file the bug in the SourceForge Bugs section or you can correct the source code and send me your patch.

Download

You can download the program from SourceForge.Net download page.

Questions

If you have a question, ask it on the Forums.

Other Links