Model:
echo empty($var['SYS_MODEL']) ? 'N/A' : "{$var['SYS_MODEL']}";
?>
M/B:
echo exec("dmidecode -qt2|awk -F: '/^\tManufacturer:/{m=\$2};/^\tProduct Name:/{p=\$2} END{print m\" -\"p}'");
?>
CPU:
function write($number) {
$words = ['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty','twenty-one','twenty-two','twenty-three','twenty-four','twenty-five','twenty-six','twenty-seven','twenty-eight','twenty-nine','thirty'];
return $number<=count($words) ? $words[$number] : $number;
}
$cpu = explode('#',exec("dmidecode -qt4|awk -F: '/^\tVersion:/{v=\$2};/^\tCurrent Speed:/{s=\$2} END{print v\"#\"s}'"));
$cpumodel = str_ireplace(["Processor","(C)","(R)","(TM)"],["","©","®","™"],$cpu[0]);
if (strpos($cpumodel,'@')===false) {
$cpuspeed = explode(' ',$cpu[1]);
if ($cpuspeed[0]>=1000 && $cpuspeed[1]=='MHz') {
$cpuspeed[0] /= 1000;
$cpuspeed[1] = 'GHz';
}
echo "$cpumodel @ {$cpuspeed[0]}{$cpuspeed[1]}";
} else {
echo $cpumodel;
}
?>
Cache:
$cache = explode('#',exec("dmidecode -qt7|awk -F: '/^\tSocket Designation:/{c=c\$2\";\"};/^\tInstalled Size:/{s=s\$2\";\"} END{print c\"#\"s}'"));
$socket = array_map('trim',explode(';',$cache[0]));
$volume = array_map('trim',explode(';',$cache[1]));
$name = [];
$size = "";
for ($i=0; $i
Memory:
/*
Memory Device (16) will get us each ram chip. By matching on MB it'll filter out Flash/Bios chips
Sum up all the Memory Devices to get the amount of system memory installed. Convert MB to GB
Physical Memory Array (16) usually one of these for a desktop-class motherboard but higher-end xeon motherboards
might have two or more of these. The trick is to filter out any Flash/Bios types by matching on GB
Sum up all the Physical Memory Arrays to get the motherboard's total memory capacity
Extract error correction type, if none, do not include additional information in the output
If maximum < installed then roundup maximum to the next power of 2 size of installed. E.g. 6 -> 8 or 12 -> 16
*/
$memory_installed = exec("dmidecode -qt17|awk -F: '/^\tSize: [0-9]+ MB\$/{t+=\$2};/^\tSize: [0-9]+ GB\$/{t+=\$2*1024} END{print t}'");
list($memory_maximum,$ecc_support) = array_map('trim',explode('#',exec("dmidecode -qt16|awk -F: '/^\tMaximum Capacity: [0-9]+ GB\$/{t+=\$2*1024};/^\tError Correction Type:/{e=\$2} END{print t\"#\"e}'")));
if ($memory_installed >= 1024) {
$memory_installed = round($memory_installed/1024);
$memory_maximum = round($memory_maximum/1024);
$unit = 'GB';
} else $unit = 'MB';
if ($memory_maximum < $memory_installed) {$memory_maximum = pow(2,ceil(log($memory_installed)/log(2))); $star = '*';} else $star = '';
echo "$memory_installed $unit ".($ecc_support == "None" ? "" : "$ecc_support ")."(max. installable capacity $memory_maximum $unit)$star";
?>
Network:
exec("ls /sys/class/net|grep -Po '^(bond|eth)\d+$'",$sPorts);
$i = 0;
foreach ($sPorts as $port) {
$mtu = file_get_contents("/sys/class/net/$port/mtu");
if ($i++) echo "
";
if ($port=='bond0') {
echo "$port: ".exec("grep -Pom1 '^Bonding Mode: \K.+' /proc/net/bonding/bond0").", mtu $mtu";
} else {
unset($info);
exec("ethtool ".escapeshellarg($port)."|grep -Po '^\s+(Speed|Duplex|Link\sdetected): \K[^U\\n]+'",$info);
echo (array_pop($info)=='yes' && $info[0]) ? "$port: ".str_replace(['M','G'],[' M',' G'],$info[0]).", ".strtolower($info[1])." duplex, mtu $mtu" : "$port: not connected";
}
}
?>
Kernel:
$kernel = exec("uname -srm");
echo $kernel;
?>
OpenSSL:
$openssl_ver = exec("openssl version|cut -d' ' -f2");
echo $openssl_ver;
?>
Uptime: