Function Sys_linux () {
//CPU
if (false = = ($str = @file ("/proc/cpuinfo")) return false;
&nbs p; $str = Implode ("", $str);
@preg_match_all ("/models+names{0,}:+s{0,}" ([ws) (@.] +) ([rn]+)/S ", $str, $model);
@preg_match_all ("/caches+sizes{0,}:+s{0,}" ([D.] +s{0,}[a-z]+[rn]+)/", $str, $cache);
if (False!== Is_array ($model [1])) {
$res [' CPU '] [' num '] = sizeof ($model [1]);
for ($i = 0; $i < $res [' CPU '] [' num ']; $i + +) {
$res [' CPU '] [' model '] [] = $model [1][$i];
& nbsp; $res [' CPU '] [' cache '] [] = $cache [1][$i];
}
if (False!== Is_array ($res [' CPU '] [' model ']) $res [' CPU '] [' model '] = implode ("<br/>", $res [' CPU ' [' model ']);
if (False!== Is_array ($res [' CPU '] [' cache ']) $res [' CPU '] [' cache '] = implode ("<br/>", $res [' CPU ' [' cache ']];
}
UPTIME
if (false = = ($str = @file ("/proc/uptime")) return false;
$str = Explode ("", Implode ("", $str));
$str = Trim ($str [0]);
$min = $STR/60;
$hours = $min/60;
$days = Floor ($hours/24);
$hours = Floor ($hours-($days * 24));
$min = Floor ($min-($days *)-($hours * 60));
if ($days!== 0) $res [' uptime '] = $days. " Days ";
if ($hours!== 0) $res [' uptime ']. = $hours. " Hours ";
$res [' uptime ']. = $min. " Minutes ";
MEMORY
if (false = = ($str = @file ("/proc/meminfo")) return false;
$str = Implode ("", $str);
Preg_match_all ("/memtotals{0,}:+s{0,}" ([D.] +).+? Memfrees{0,}:+s{0,} ([D.] +).+? Swaptotals{0,}:+s{0,} ([D.] +).+? Swapfrees{0,}:+s{0,} ([D.] +)/S ", $str, $buf);
$res [' memtotal '] = round ($buf [1][0]/1024, 2);
$res [' memfree '] = round ($buf [2][0]/1024, 2);
$res [' memused '] = ($res [' Memtotal ']-$res [' Memfree ']);
$res [' mempercent '] = (floatval ($res [' memtotal '])!=0)? Round ($res [' memused ']/$res [' Memtotal ']*100,2]: 0;
$res [' swaptotal '] = round ($buf [3][0]/1024, 2);
$res [' swapfree '] = round ($buf [4][0]/1024, 2);
$res [' swapused '] = ($res [' Swaptotal ']-$res [' Swapfree ']);
$res [' swappercent '] = (floatval ($res [' swaptotal '])!=0)? Round ($res [' swapused ']/$res [' Swaptotal ']*100,2]: 0;
LOAD AVG
if (false = = ($str = @file ("/proc/loadavg")) return false;
$str = Explode ("", Implode ("", $str));
$str = Array_chunk ($str, 4);
$res [' loadavg '] = Implode ("", $str [0]);
return $res;}