I am building a custom component for my webapp that will benchmark each service, so far the plan is to benchmark the usual stuff:
- Response Time
- Memory
- Current server activity
etc.
I have built the basic stuff and i was thinking to store the output of the linux "top" command, which lists the current running processes and the amount of used resources. Though, i haven't been able to obtain any responde from running:
$output = shell_exec('top');
echo "<pre>";
var_dump($output);
echo "</pre>";
But other simpler commands do work, like the example in the php manual:
$output = shell_exec('ls -lart');
So my questions are: - Do I need to run the "top" command as root? (currently it runs under apache user) - Or are there any other php command that could help me get server statistics?
I read this post, but im not really interested in installing anything, as i need my stats on the demand and store them on my DB. PHP server statistics script?