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'; } function vpn_peers($file) { $peers = []; $entries = array_filter(array_map('trim',preg_split('/\[(Interface|Peer)\]/',file_get_contents($file)))); foreach($entries as $key => $entry) { $noname = true; foreach (explode("\n",$entry) as $row) { if ($key>1 && $row[0]=='#') {$peers[$key-1] = substr($row,1); $noname = false;} } if ($key>1 && $noname) $peers[$key-1] = "Peer ".($key-1); } return $peers; } $dockerd = pgrep('dockerd'); $libvirtd = pgrep('libvirtd'); $apcupsd = file_exists('/var/run/apcupsd.pid'); $wireguard = is_executable('/usr/bin/wg') && file_exists('/var/log/plugins/dynamix.wireguard.plg'); $started = $var['fsState']=='Started'; $sleep = isset($display['sleep']); $cache_pool = $var['cacheSbNumDisks']; $array_size = $array_used = 0; $cache_size = $cache_used = 0; $extra_size = $extra_used = 0; $cache_type = 'disk'; $parity = $var['mdResync']; $mover = file_exists('/var/run/mover.pid'); $btrfs = exec('pgrep -cf /sbin/btrfs'); 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); $conf = $wireguard ? glob('/etc/wireguard/wg*.conf') : []; $wg_up = $wireguard ? exec("wg show interfaces") : ''; $wg_up = $wg_up ? explode(' ',$wg_up) : []; $up = count($wg_up); $down = max(count($conf)-$up,0); $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']}".($board['Version'] ? ", Version {$board['Version']}" : ""); $bios = dmidecode('BIOS Information','0',0); $biosdate = "BIOS dated: ".my_time(strtotime($bios['Release Date']),$display['date']); $bios = $bios['Vendor'].($bios['Version'] ? ", Version {$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 (!is_numeric($device['Size'][0])) continue; list($size, $unit) = explode(' ',$device['Size']); $base = array_search($unit,$sizes); if ($base!==false) $memory_installed += $size*pow(1024,$base); if (!$memory_type && $device['Type']!='Unknown') $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))); ?> $N=0?>
| =$var['NAME']?> -circle busy' title='=$started?'Stop':'Start'?> the array'> -circle hand' title='=$started?'Stop':'Start'?> the array' onclick='=$started?'Stop':'Start'?>Array()'> | |||||||
|
Description
=$var['COMMENT']?> =$var['SYS_MODEL']?> Registration Unraid OS =$var['regTy']?> Uptime ","Select Case Model",700,980,true,"setCase");return false'> | |||||||
Motherboard
| |||||||
| =$board?> =$bios?> =$biosdate?> | |||||||
Processor
Load: 0% | |||||||
| =$cpumodel?> Show details | |||||||
| Overall Load: | 0% | ||||||
| "; if ($cpu2) echo " | CPU $cpu1 - HT $cpu2 | 0% | 0% | ";
else
echo "CPU $cpu1 | 0% | ";
echo "||
Memory
="$memory_installed $unit $memory_type $ecc"?>Utilization: 0% | |||||||
| Maximum size: ="$memory_maximum $unit"?>=$low?'*':''?> | RAM0% |
Flash0% | |||||
| Usable size: =my_scale($total,$unit,1,null,1024)." $unit"?> | Log0% |
Docker0% | |||||
Interface
Inbound: ---Outbound: --- | |||||||
| Mode of operationReceived packetsReceive counters | Transmitted packetsTransmit counters | ||||||
| $port | |||||||
| $port | |||||||
| $port | |||||||
VPN
Active tunnels: =$up?>Inactive tunnels: =$down?> | |||||||
| ' onclick="toggleVPN($(this),'=$vpn?>')" title="Toggle tunnel state">="Tunnel $vpn"?> | Activity | Handshake | |||||
| =$peer?> | --- | inactive | |||||
Power
UPS Load: | |||||||
|
UPS status: Battery charge: Runtime left: Nominal power: | |||||||
Airflow
Fan count: =$fans?> | FAN ".($f)." - FAN ".($f+1)." | "." | "; else echo " | ||||
| FAN ".($f)." | |||||||
| Docker Containers | |||||
| Virtual Machines | |||||
| Shares Share count: =count($shares)?> with =$cache_only?> cache only and =$encrypted?> encrypted | |||||
| Name | Description | Security | Streams | ||
| $list | $comment | $security | 0 | ||
| No shares present | |||||
| $list | $comment | $security | - | ||
| No shares present | |||||
| $list | $comment | $security | - | ||
| No shares present | |||||
| $list | $comment | - | - | ||
| No shares present | |||||
| Users User count: =count($users)?> with =$nopass?> unprotected | |||||
| Name | Description | Write | Read | ||
| $list | $desc | $write | $read | ||
| $list | $desc | $write | $read | ||
| $list | $desc | $write | $read | ||
| $list | $desc | - | - | ||