<?php
function get_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(round($memory_usage,2));
}
function get_number_threads(){
$threads = shell_exec('ps -eo nlwp | tail -n +2 | awk \'{ num_threads += $1 } END { print num_threads }\'');
return($threads);
}
function get_number_users(){
$users = shell_exec('users | wc -w');
return($users);
}
function get_used_space(){
$ds = shell_exec('df -h /');
$arr_ds = explode("\n",$ds);
$line = $arr_ds[1];
$arr_data = explode(' ',$line);
return(round(intval($arr_data[4]),2));
}
if(isset($_GET['monitor']) && function_exists ($_GET['monitor'])){
echo(call_user_func($_GET['monitor']));
}
|