loadavg is a simple and lightweight method of monitoring load, memory usage and transfer throughput on a Linux server.Every method of monitoring has an impact on the system being monitored — loadavg is designed to keep that impact as low as possible. It generates HTML & CSS charts, thereby shifting much of the work from the server to the client — your web browser.
loadavg consists of two scripts
logger.php simply reads a few files in /proc and writes out a line of data to a log file. It takes very little CPU time
index.php reads through that logfile and produces HTML output for each line. This HTML is then compressed and
transmitted to you. Again, that takes very little server CPU and memory.
Perhaps the most intensive part of the whole operation is the decompression and rendering of the HTML, which is done by
the web browser on your workstation.
Linux Operating System
Apache webserver with php support
PHP safe mode off. Safe mode disables the ability to run programs outside the script directory
Installation and Configuration
First thing is you need to install apache webserver with php support you can check here for this
Now you need to download loadavg script in you webserver root directory i am using debian and this can be same for
ubuntu and other debian derivated distributions
My webserver root document path is /var/www/
/var/www# wget http://www.labradordata.ca/downloads/loadavg.tar.gz
/var/www#tar -zxf loadavg.tar.gz
When you extract the tarball, a “loadavg” directory will be created.
Next you edit the file “config.php” and set the correct path for the variable “$datadir”. Your path will probably look something like this and you need to change this.
$datadir = ‘/home/USER/public_html/loadavg/logs/’;
$datadir = ‘/var/www/loadavg/logs/’;
Adjust the path as necessary. Make sure there is a trailing slash. Other settings in config.php may be changed according to personal preference.
Also set the correct value for “$eth”, your ethernet interface. The default value is “venet0” for a VPS. Change it to “eth0” for a dedicated machine (or whichever interface you use):
$eth = ‘venet0’;
$eth = ‘eth0’;
Next you need to set the cronjob. The script “logger.php” must be set to run exactly every 6 minutes. Do NOT attempt to change the timing, it simply will not work correctly.
Use “crontab -e” to edit the crontab and insert a line something like this:
*/6 * * * * /usr/bin/php -q /var/www/loadavg/logger.php >/dev/null 2>&1
Edit the paths to php and logger.php as necessary.
The logger.php must run 3 times before there is enough data to start producing charts. In 20 minutes or so, check the
index.php page in your web browser.
You should see the following screen
There are a number of settings in config.php which may be tailored to your personal preference. See the comments in
In particular you may want to adjust the $txchart and $rxchart values. These determine the y-axis (vertical) scale of
the transmit & receive charts. For example, if you regular do 30 KB/sec transmit, set $txchart to a value slightly higher, perhaps 50 KB/sec.
Note on First Day Results:
The loadavg graphs will not display quite right during your first day. Once the second day is started the graphs will be correct. This is a design issue that may (or may not) eventually be fixed.
If you want to know about this script check here for more details