I have a Windows VPS and a website with an administration for a game. I wish that in my administration I can recover the use of the CPU in % as well as the use of RAM and that values update when the values change.
Is that possible?
I have a Windows VPS and a website with an administration for a game. I wish that in my administration I can recover the use of the CPU in % as well as the use of RAM and that values update when the values change.
Is that possible?
if you mean how much ram/cpu php is using then you can do the following using plain php without using any package: this returns the ram usage:
function get_server_memory_usage(){
$free = shell_exec('free');
$free = (string)trim($free);
$free_arr = explode("\n", $free);
$mem = explode(" ", $free_arr[1]);
$mem = array_filter($mem);
$mem = array_merge($mem);
$memory_usage = $mem[2]/$mem[1]*100;
return $memory_usage;
}
cpu usage:
function get_server_cpu_usage(){
$load = sys_getloadavg();
return $load[0];
}
You can use PHPSYSINFO. The links are below. It is a php script, just upload it to your server folder and make the required configuration.
Link: http://phpsysinfo.github.io/phpsysinfo/ and https://github.com/phpsysinfo/phpsysinfo