LoadAvg polls your system information and stores this data in log files that it uses to create and display its charts and graphs. Once you have installed LoadAvg you will need to set up logging so it can capture this information.

loadavg_step3

Logging is currently done via a script called logger.php that is located in the home/root directory of your loadavg installation. For it to collect data in a timely manner you will need to set up a cron script to call the logger every 5 minutes*, this critical for loadavg to function.

*Note you can configure the logger to poll at different intervals from 1 minute up, but every 5 minutes is the recommended value. If you change the interval you will also need to change it in the LodaAvg Logger settings page so your charts render correctly.

Adding the Logger to Cron

To add the logger to your cront-tab you will need to edit your crontab. Use “sudo crontab -e” (or your control panel or other text editor) to edit the crontab as root and insert a line like this (edit the paths to php and paths to logger.php as necessary or as given to you by the installer):

sudo crontab -e

*/5 * * * * /PATH/TO/php -q /PATH/TO/logger.php /dev/null 2>1

Finding the paths

LoadAvg will automatically locate php and your installation in step 3 of the installation and give you the correct line to insert in your crontab. You can also find this data from the ‘Logger’ setting in the LoadAvg options.

If you are having trouble finding the paths you and use the commands “whereis” and “pwd” to find out where loadavg is installed and where php is installed.

To find out where loadavg is installed, navigate to the directory where logger.php is located and type:

pwd

To find out where php is installed, then simply type

whereis php

For eg, on our system here it is:


*/5 * * * * /usr/bin/php -q /usr/share/loadavg/logger.php /dev/null 2>1

Testing the Logger

You can test run the logger at anytime from the root or home of your LoadAvg installation. The logger has a few modes as well, a “status” mode to check if all modules are logging data, and a “time” mode to help with speed and load testing of the logger See sample output below.


php logger.php


php logger.php status

[[email protected] httpdocs]# php logger.php status
Testing Logger
Log: /vhosts/loadavg/httpdocs/logs/cpu_2014-11-14.log Status: 1
Log: /vhosts/loadavg/httpdocs/logs/disk_usage_2014-11-14.log Status: 1
Log: /vhosts/loadavg/httpdocs/logs/memory_usage_2014-11-14.log Status: 1
Log: /vhosts/loadavg/httpdocs/logs/network_2014-11-14_ens33.log Status: 1
The logger appears to be running


php logger.php time

[[email protected] httpdocs]# php logger.php time
Start Time : 1416026310.8467
Module Cpu Time : 0.0055990219116211
Module Disk Time : 0.0054931640625
Module Memory Time : 0.003389835357666
Module Network Time : 0.00057601928710938
End Time : 1416026310.8637
Total Time : 0.016964912414551
: 0.017

Browse our modules

Once you have LoadAVG up and running, and receiving log data, view the different modules that are available and see how to set them up.