Commit d0e40d0e authored by SteffTek's avatar SteffTek

Backend Ready

parent af22efca
Pipeline #6 canceled with stages
<?php
function get_server_cpu_usage(){
$exec_loads = sys_getloadavg();
$exec_cores = trim(shell_exec("grep -P '^processor' /proc/cpuinfo|wc -l"));
return round($exec_loads[1]/($exec_cores + 1)*100, 0);
}
echo get_server_cpu_usage();
?>
<?php
$path = '/';
$free = floor( disk_free_space( $path ) / ( 1024 * 1024 * 1024) );
$total = floor( disk_total_space( $path ) / (1024 * 1024 * 1024) );
echo $free . '/' . $total
?>
\ No newline at end of file
<?php
function get_server_memory_usage(){
$exec_free = explode("\n", trim(shell_exec('free')));
$get_mem = preg_split("/[\s]+/", $exec_free[1]);
$mem = round($get_mem[2]/$get_mem[1]*100, 0);
return $mem;
}
echo get_server_memory_usage();
?>
\ No newline at end of file
<?php
function get_server_memory_usage(){
$exec_free = explode("\n", trim(shell_exec('free')));
$get_mem = preg_split("/[\s]+/", $exec_free[1]);
$mem = number_format(round($get_mem[2]/1024/1024, 2), 2) . '/' . number_format(round($get_mem[1]/1024/1024, 2), 2);
return $mem;
}
echo get_server_memory_usage();
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment