Menu="Dashboard" Nchan="wg_poller,update_1,update_2,update_3,ups_status:stop" --- 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) { [$key,$value] = explode(': ',trim($line)); $property[$key] = $value; } $properties[] = $property; } return $all ? $properties : $properties[0]; } function export_settings($protocol,$share) { if ($protocol!='yes' || $share['export']=='-') return "-"; if ($share['export']=='e') return _(ucfirst($share['security'])); return ''._(ucfirst($share['security'])).''; } 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'); $conf = glob('/etc/wireguard/wg*.conf'); $wireguard = is_executable('/usr/bin/wg') && count($conf); $started = $var['fsState']=='Started'; $sleep = isset($display['sleep']); $array_size = $array_used = 0; $extra_size = $extra_used = 0; $cache_size = $cache_used = []; $cache_type = $cache_rate = []; $parity = $var['mdResync']; $mover = file_exists('/var/run/mover.pid'); $btrfs = exec('pgrep -cf /sbin/btrfs'); $dot = $display['number'][0]; 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': $name = $disk['name']; if (in_array($name,$pools)) { $cache_size[$name] = $disk['fsSize']; $cache_used[$name] = $disk['fsSize']-$disk['fsFree']; $cache_type[$name] = $disk['rotational'] ? ($disk['luksState'] ? 'disk-encrypted' : 'disk') : 'nvme'; $cache_rate[$name] = number_format(100*$cache_used[$name]/($cache_size[$name] ?: 1),1,$dot,''); if (!$disks[$name]['devices']) unset($pools[array_search($name,$pools)]); } break; } } foreach ($devs as $disk) { $extra_size += $disk['sectors']*$disk['sector_size']; } $array_percent = number_format(100*$array_used/($array_size ?: 1),1,$dot,''); exec('cat /sys/devices/system/cpu/*/topology/thread_siblings_list|sort -nu', $cpus); $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'"); $autofan = is_executable("$docroot/plugins/dynamix.system.autofan/scripts/rc.autofan"); $group = $var['shareSMBEnabled']=='yes' | $var['shareNFSEnabled']=='yes'; $names = []; $cache_only = $encrypted = 0; foreach ($shares as $share) { if ($share['useCache']=='only') $cache_only++; if ($share['luksStatus']>0) $encrypted++; } $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']),0); $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"); unset($ports); 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; [$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) { [$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))); switch ($display['theme']) { case 'white': $color = '#1c1b1b'; $grid = '#e3e3e3'; break; case 'black': $color = '#f2f2f2'; $grid = '#2b2b2b'; break; case 'azure': $color = '#606e7f'; $grid = '#f3f0f4'; break; case 'gray' : $color = '#606e7f'; $grid = '#0c0f0b'; break; default : $color = '#1c1b1b'; $grid = '#e3e3e3'; break; } ?> $N=0?>
| =$var['NAME']?> -circle busy' title="=$started?_("Stop the array"):_("Start the array")?>"> -circle hand' title="=$started?_("Stop the array"):_("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?'*':''?> | _(RAM)_0% |
_(Flash)_0% | |||||
| _(Usable size)_: =my_scale($total,$unit,1,null,1024)." $unit"?> | _(Log)_0% |
_(Docker)_0% | |||||
_(Interface)_
_(Inbound)_: ---_(Outbound)_: --- | |||||||
| _(Mode of operation)__(Received packets)__(Receive counters)__(Inbound)_ | _(Transmitted packets)__(Transmit counters)__(Outbound)_ | ||||||
| $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?> | |||||||
| "; $tr_end = " | "._('FAN')." $fan | "; $row[$i] .= ""; } $rest = ($fans%3) ? 3-($fans%3) : 0; for ($fan=0; $fan<$rest; $fan++) $hdr[$i] .= " | "; $row[$i] .= " | "; if ($rest) {$hdr[$i] .= $tr_end; $row[$i] .= $tr_end;} for ($n=0; $n<=$i; $n++) echo $hdr[$n].$row[$n]; ?> | |||
| _(Docker Containers)_ | |||||
| _(Virtual Machines)_ | |||||
| _(Shares)_ =sprintf(_("Share count: %s with %s cache only and %s encrypted"),count($shares),$cache_only,$encrypted)?> | |||||
| _(Name)_ | _(Description)_ | _(Security)_ | _(Streams)_ | ||
| $list | $comment | $security | 0 | ||
| "._("No shares present")." | |||||
| $list | $comment | $security | - | ||
| "._("No shares present")." | |||||
| $list | $comment | - | - | ||
| "._("No shares present")." | |||||
| _(Users)_ =sprintf(_("User count: %s with %s unprotected"),count($users),$nopass)?> | |||||
| _(Name)_ | _(Description)_ | _(Write)_ | _(Read)_ | ||
| $list | $desc | $write | $read | ||
| $list | $desc | $write | $read | ||
| $list | $desc | - | - | ||