making bbPress (and WordPress) work better!

LoadAVG patch for more frequent logging and bug fixes

LoadAVG is a free, simple but very useful and lightweight load monitor for servers & VPS.

I encourage everyone to install it if you run a VPS because it will give you an easy snapshot of what is really going on with your server’s performance with virtually no impact otherwise.

It was written in 2006 in PHP by Doug Robbins of Labrador Data (with contributions by David Eshelman) then moved to Silversoft and finally released to the public on it’s own website under GPL – it is no longer updated, the final version came out in June 2010.

It does have a couple of bugs, some less than optimal calculations and inconsistent use of PHP, but nothing that is really a showstopper and it still works.

It’s basic design is to log every 6 minutes (10 times per hour) the server loads for 1/5/15 minute average, the amount of data transmitted and received, and how much memory has been allocated/reserved at that moment. Then it graphs the data using simple html and css on demand and also calculates high/low/averages for those numbers.

After using it for years I decided to finally fix some of the minor bugs (including the graph annoyingly doubling in height in certain conditions) and also increase the monitoring to every 3 minutes for more granular data – today’s servers/browsers can easy handle 20 datapoints per hour vs ten, and it’s important to find frequent load spikes that are even just a couple minutes long which are missed with only 6 minute logging.

So I’ve decided to share my replacement for calculations.php which has the bulk of those important fixes/changes.

view / download (save as/replace calculations.php)

Once you have that replaced, if you also want 3 minute updates instead of six, just change your crontab from */6 to */3

I’ve made the calculations.php backwards compatible with old data, so you won’t lose anything. You can replace it at anytime, but you do have to make one other tiny change after you do that, edit the display.css,
search for,,div.rd,div.wh,div.yl {
and change the width: 1px; to width: 2px;

That’s it. Then you will notice your old data is spaced apart by 1px but the new data will be a finer resolution.

Note that my update removes IE 5/6/7 support but IE9 should probably function (and maybe IE8 but why are you using IE ?).

If there is any further interest, I’ll eventually release my other improvements to this program since it’s GPL.

By the way, if you are using plesk instead of cpanel, etc. you may have had trouble getting the log to work properly. This is because the PHP on plesk when run from the command line (CLI) runs in safe-mode, even though it’s running as root. So to fix that, add -d safe_mode=Off after the php like this

*/3 * * * * /usr/bin/php -q -d safe_mode=Off /var/www/vhosts/ >/dev/null 2>&1

One response

  1. Alex

    Hello, thanks for the patch. Sometimes I’ve experienced problems with the graphs. Can you share your code? Thanks

    May 4, 2012 at 5:49 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s