Menu="Dashboard" --- function dmidecode($key,$n,$all=true) { $entries = array_filter(explode($key,shell_exec("dmidecode -qt$n"))); $properties = []; foreach ($entries as $entry) { $property = []; foreach (explode("\n",$entry) as $line) if (strpos($line,': ')!==false) { list($key,$value) = explode(': ',trim($line)); $property[$key] = $value; } $properties[] = $property; } return $all ? $properties : $properties[0]; } function truncate($string,$len) { return strlen($string) < $len ? $string : substr($string,0,$len-3).'...'; } function export_settings($protocol,$share) { if ($protocol!='yes' || $share['export']=='-') return "-"; if ($share['export']=='e') return ucfirst($share['security']); return ''.ucfirst($share['security']).''; } function data_devices($disk) { return $disk['type']=='Data'; } function cache_devices($disk) { return $disk['type']=='Cache'; } $dockerd = pgrep('dockerd'); $libvirtd = pgrep('libvirtd'); $started = $var['fsState']=='Started'; $array_size = $array_used = 0; $cache_size = $cache_used = 0; $extra_size = $extra_used = 0; $cache_type = 'disk'; foreach ($disks as $disk) { switch ($disk['type']) { case 'Data': if (isset($disk['fsFree'])) { $array_size += $disk['fsSize']; $array_used += $disk['fsSize']-$disk['fsFree']; } break; case 'Cache': if ($disk['name']=='cache') { $cache_size = $disk['fsSize']; $cache_used = $disk['fsSize']-$disk['fsFree']; $cache_type = $disk['rotational'] ? ($disk['luksState'] ? 'disk-encrypted' : 'disk') : 'nvme'; } break; } } foreach ($devs as $disk) { $extra_size += $disk['sectors']*$disk['sector_size']; } $dot = $display['number'][0]; $array_percent = number_format(100*$array_used/($array_size ?: 1),1,$dot,''); $cache_percent = number_format(100*$cache_used/($cache_size ?: 1),1,$dot,''); exec('cat /sys/devices/system/cpu/*/topology/thread_siblings_list|sort -nu', $cpus); $fans = exec("sensors -uA 2>/dev/null|grep -c 'fan[0-9]_input'"); $group = $var['shareSMBEnabled']=='yes' | $var['shareAFPEnabled']=='yes' | $var['shareNFSEnabled']=='yes'; $url = "/webGui/include/DashUpdate.php"; $names = []; $cache_only = $encrypted = 0; foreach ($shares as $share) { $names[] = $share['name']; if ($share['useCache']=='only') $cache_only++; if ($share['luksStatus']) $encrypted++; } $names = implode(',',$names); $passwd = $nopass = 0; foreach ($users as $user) if ($user['passwd']=='yes') $passwd++; else $nopass++; $boot = "/boot/config/plugins/dynamix"; $myfile = "case-model.cfg"; $mycase = file_exists("$boot/$myfile") ? file_get_contents("$boot/$myfile") : false; $board = dmidecode('Base Board Information','2',0); $serial = "s/n: {$board['Serial Number']}"; $board = "{$board['Manufacturer']} {$board['Product Name']} - v{$board['Version']}"; $bios = dmidecode('BIOS Information','0',0); $biosdate = "BIOS dated: ".my_time(strtotime($bios['Release Date']),$display['date']); $bios = "{$bios['Vendor']} - v{$bios['Version']}"; $cpu = dmidecode('Processor Information','4',0); $cpumodel = str_ireplace(["Processor","(C)","(R)","(TM)"],["","©","®","™"],$cpu['Version']); $cpumodel .= (strpos($cpumodel,'@')!==false ? "" : " @ {$cpu['Current Speed']}"); $total = exec("awk '/^MemTotal/{print $2*1024}' /proc/meminfo"); exec("ls /sys/class/net|grep -Po '^(lo|(bond|eth)\d+)$'",$ports); $sizes = ['MB','GB','TB']; $memory_type = $ecc = ''; $memory_installed = $memory_maximum = 0; $memory_devices = dmidecode('Memory Device','17'); foreach ($memory_devices as $device) { if ($device['Type']=='Unknown') continue; list($size, $unit) = explode(' ',$device['Size']); $base = array_search($unit,$sizes); if ($base!==false) $memory_installed += $size*pow(1024,$base); if (!$memory_type) $memory_type = $device['Type']; } $memory_array = dmidecode('Physical Memory Array','16'); foreach ($memory_array as $device) { list($size, $unit) = explode(' ',$device['Maximum Capacity']); $base = array_search($unit,$sizes); if ($base>=1) $memory_maximum += $size*pow(1024,$base); if (!$ecc && $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))); ?>
| =$var['NAME']?> | ||||
|
Description =$var['COMMENT']?> =$var['SYS_MODEL']?> Registration Unraid OS =$var['regTy']?> Uptime |
","Select Case Model",600,900,true,"setCase");return false' style='margin:12px 0 0 0;padding:5px 10px'> | |||
Motherboard
| ||||
Processor
Load: 0% | ||||
Memory
="$memory_installed $unit $memory_type $ecc"?>Utilization: 0% | ||||
Interface
Inbound: ---Outbound: --- | ||||
Airflow Fan count: $fans | ||||
| Docker Containers | |||||
| Virtual Machines | |||||
| Shares Share count: =count($shares)?> with =$cache_only?> cache only and =$encrypted?> encrypted | |||||
| $list | $comment | $security | 0 | ||
| No shares present | |||||
| $list | $comment | $security | - | ||
| No shares present | |||||
| $list | $comment | $security | - | ||
| No shares present | |||||
| $list | $comment | - | - | ||
| No shares present | |||||
| UsersUser count: =count($users)?> with =$nopass?> unprotected | |||||
| $list | $desc | $write | $read | ||
| $list | $desc | $write | $read | ||
| $list | $desc | $write | $read | ||
| $list | $desc | - | - | ||
| Parity | ||||||
| Array not started =my_scale($array_used*1024,$unit)." $unit"?> used of =my_scale($array_size*1024,$unit,-1,-1)." $unit"?> (=$array_percent?> %) | ||||||
| Cache not started =my_scale($cache_used*1024,$unit)." $unit"?> used of =my_scale($cache_size*1024,$unit,-1,-1)." $unit"?> (=$cache_percent?> %) | ||||||
| Extra | ||||||