#!/usr/bin/php -q '; if (strpos($strCPUInfo,'vmx')===false && strpos($strCPUInfo, 'svm')===false) { // CPU doesn't support virtualization $hvm .= _('Not Available'); } else { // Motherboard either doesn't support virtualization or BIOS has it disabled $hvm .= _('Disabled'); } $hvm .= ''; } // Check for any IOMMU Groups $iommu_groups = shell_exec("find /sys/kernel/iommu_groups/ -type l"); if (!empty($iommu_groups)) { // Yah! CPU and motherboard supported and enabled in BIOS $iommu = _('Enabled'); } else { $iommu = ''; if (strpos($strCPUInfo,'vmx')===false && strpos($strCPUInfo, 'svm')===false) { // CPU doesn't support virtualization so iommu would be impossible $iommu .= _('Not Available'); } else { // Motherboard either doesn't support iommu or BIOS has it disabled $iommu .= _('Disabled'); } $iommu .= ''; } $cache_installed = []; $cache_devices = dmidecode('Cache Information',7); foreach ($cache_devices as $device) $cache_installed[] = $device['Socket Designation'].": ".str_replace(['kB','B'],['KB','iB'],$device['Installed Size']); /* 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 */ $sizes = ['MB','GB','TB']; $memory_type = $ecc = ''; $memory_installed = $memory_maximum = 0; $memory_devices = dmidecode('Memory Device',17); $modules = 0; foreach ($memory_devices as $device) { if (empty($device['Type']) || $device['Type']=='Unknown') continue; [$size, $unit] = my_explode(' ',$device['Size']); $base = array_search($unit,$sizes); if ($base!==false) $memory_installed += $size*pow(1024,$base); if (!$memory_type) $memory_type = $device['Type']; $modules++; } $memory = $modules > 1 ? ""._('Memory').":" : _('Memory').':'; $memory_array = dmidecode('Physical Memory Array',16); foreach ($memory_array as $device) { [$size, $unit] = my_explode(' ',$device['Maximum Capacity']); $base = array_search($unit,$sizes); if ($base>=1) $memory_maximum += $size*pow(1024,$base); if (!$ecc && isset($device['Error Correction Type']) && $device['Error Correction Type']!='None') $ecc = $device['Error Correction Type']." "; } if ($memory_installed >= 1024) { $memory_installed = round($memory_installed/1024); $memory_maximum = round($memory_maximum/1024); $unit = 'GiB'; } else $unit = 'MiB'; // If maximum < installed then roundup maximum to the next power of 2 size of installed. E.g. 6 -> 8 or 12 -> 16 $low = $memory_maximum < $memory_installed; if ($low) $memory_maximum = pow(2,ceil(log($memory_installed)/log(2))); $style = ""; $list = []; $list[] = ""; $list[] = ""; $list[] = ""; $list[] = ""; $list[] = ""; $list[] = ""; $list[] = ""; $list[] = ""; foreach ($memory_devices as $device) { if (empty($device['Type']) || $device['Type']=='Unknown') continue; $size = preg_replace('/( .)B$/','$1iB',_var($device,'Size',0)); $list[] = ""; } exec("ls --indicator-style=none /sys/class/net|grep -Po '^(bond|eth)\d+$'",$sPorts); $i = 0; $network = count($sPorts) > 1 ? ""._('Network').":" : _('Network').':'; foreach ($sPorts as $port) { $int = "/sys/class/net/$port"; $mtu = file_get_contents("$int/mtu"); $link = @file_get_contents("$int/carrier")==1; $name = $i ? "" : $network; $more = $i++ ? "port" : ""; if (substr($port,0,4)=='bond') { if ($link) { $bond_mode = str_replace('Bonding Mode: ','',file("/proc/net/bonding/$port",FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)[1]); $list[] = ""; } else { $list[] = ""; } } else { if ($link) { $speed = file_get_contents("$int/speed"); $duplex = file_get_contents("$int/duplex"); $list[] = ""; } else { $list[] = ""; } } } $list[] = ""; $list[] = ""; $list[] = "
"._('Model').":$model
".('M/B').":{$board['Manufacturer']} {$board['Product Name']} {$board['Version']} {$board['Serial Number']}
"._('BIOS').":{$bios['Vendor']} {$bios['Version']} {$bios['Release Date']}
"._('CPU').":$cpumodel {$cpu['Current Speed']}
"._('HVM').":$hvm
"._('IOMMU').":$iommu
"._('Cache').":".implode(', ',$cache_installed)."
$memory$memory_installed $unit $memory_type $ecc("._('max. installable capacity')." $memory_maximum $unit".($low?'*':'').")
".$device['Locator'].": "._var($device,'Manufacturer')." "._var($device,'Part Number').", $size "._var($device,'Type')." @ "._var($device,'Configured Memory Speed')."
$name$port: $bond_mode, mtu $mtu
$name$port: "._("bond down")."
$name$port: $speed Mbps, $duplex duplex, mtu $mtu
$name$port: "._("interface down")."
"._('Kernel').":$kernel
"._('OpenSSL').":$openssl
"._('Uptime').":
"; echo $style,implode($list); ?>