Script : Server Load

Script : Server Load

Here’s another script that may interest some of you – the SERVER LOAD script.

Yup, what more a convenient way to monitor the load of the server you’re on! Many have requested this script so here it is……

The Script

1
2
3
4
5
6
7
8
9
<?$loadresult = @exec('uptime');
preg_match("/averages?: ([0-9\.]+),[\s]+([0-9\.]+),[\s]+([0-9\.]+)/",
$loadresult,$avgs);
 
$svrld=(($avgs[1]/8)*100);
 
$data .= "Server Load is $svrld%\n";
echo $data;
?>

Easy isn’t it?

Now all you need to do is EDIT line #5. In my case, the server runs on an 8 core processor system so the number is 8. Just change the number to whatever the # of processor core that is on the server you’re on. (Don’t ask me! Find out from your host!).

Line #7 is the output that line #8 is going to produce, so just edit like #7 any way you like, just leave the $svrld% there.

Give it a try! ๐Ÿ™‚

*It works on servers with Intel processor.
*It doesn’t work on Windows-based web hosting.
*It would not work if the administrator disabled the function.

Remember, don’t blame me if it doesn’t work on your hosting plan.

goldfries rated this product :

5 Comments

  1. This is what i am looking for… thanks..

  2. rwar!

    nice script, but the function was disabled by my host so …

    anyway, my cpu usage is okay now after i de-activated the plugins as recommeded by my host.

  3. Author

    too bad lor. Ah Kong ah, why you come use name Flash Games Download ah? no good leh. ๐Ÿ™‚

  4. hm… I need to do some changes to the codes. If I follow the codes by goldfries, my server load will be 100+%.

    So, what I did was, instead of multiply by 100, I multiply by 10.
    So, when I checked with host server load, it synchronize.

Comments are closed.