Server Load
By: Daniel

Monitoring the load on your server is very important and sometimes vital. To do this very quick and easy on your linux server requires 1 line of code to get.

<?php
$load = explode(" ", exec("cat /proc/loadavg"));
echo 'Server Load: '.$load[0].'%&nbsp;&nbsp;'.$load[1].'%&nbsp;&nbsp;'.$load[2].'%';
?>

The above code will output something similar to: Server Load: 0.01% 0.02% 0.00%

**NOTE: Your server must allow you to run the exec() php command. Some hosts disable the execution of this and several other php functions.

1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 4.00 out of 5)
Loading ... Loading ...

2 Responses to “Server Load”

  1. Nabyimmededay Says:

    Hello

    As a fresh http://www.wlscripting.com user i just want to say hello to everyone else who uses this board :-D

  2. Malcom Says:

    You guys do a wonderful job! Keep up the good work!!!t

Leave a Reply

geovisitors