Script : Server Load
April 13th, 2009 | Viewed 3504 timesHere’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.




April 14th, 2009 at 12:57 am
This is what i am looking for… thanks..
April 20th, 2009 at 12:57 am
You’re welcome!
April 20th, 2009 at 12:03 pm
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.
April 28th, 2009 at 11:55 am
too bad lor. Ah Kong ah, why you come use name Flash Games Download ah? no good leh.
April 28th, 2009 at 3:59 pm
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.