Page 1 of 1

How do I see SERVER Stats in php?

Posted: Sat Feb 18, 2006 10:43 pm
by Deseree
Hi,
I saw on some php sites they displayed some stats in php, like especially I'm talking about the 1,5,10,15 minute load variables and anything else that is handy, those are extremely important tho....

ty.

Posted: Sun Feb 19, 2006 12:53 am
by anjanesh

Posted: Sun Feb 19, 2006 1:23 am
by Deseree
hah, but no. I don't believe that shows the server's load, does it?

Posted: Sun Feb 19, 2006 1:27 am
by feyd
no.. and nothing built into php will. The information is pulled from calling various status commands to the operating system. I don't recall the particular commands offhand.

Posted: Sun Feb 19, 2006 2:18 am
by anjanesh
I remember that some control panels give this sort of info using their API service. Plesk has its Command Line Interface through which you can get info in php - but I dont know if you can get server load etc.
BTW, the reseller's control like WHM etc should allow you to get info via their API - again I've not really checked - but I've read it elsewhere.

Posted: Sun Feb 19, 2006 4:26 am
by s.dot
cPanel (if installed on your server) will show you server load stats, amongst others.

If you're on a shared host, to find out if you have it go to yourdomain.com/cpanel
If you're on a dedicated server and you have it installed... well then you should already know :P But I believe the default port is 2086, so yourdomain.com:2086

Posted: Sun Feb 19, 2006 5:49 am
by anjanesh
But I believe the default port is 2086, so yourdomain.com:2086
Port is 2082 but I think the OP was looking for a way to get the results via php in his code. Im not so sure but CPanel may have some APIs for this. I think WHM, DirectAdmin has API for these.

Posted: Sun Feb 19, 2006 5:58 am
by Dale
2082 - cPanel
2086 - WHM
2095 - Mail

:)

Posted: Sun Feb 19, 2006 11:42 am
by Deseree
uhm, the idea behind this is a php load balancing script, not to run if the load is high.

So how would I get the load in a php script ? the exec() or system() command CAN BE USED in this case, this script will run at the root level.

Posted: Sun Feb 19, 2006 2:04 pm
by phpkar

Posted: Sun Feb 19, 2006 2:07 pm
by Deseree
rightous, much appreciated