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] = my_explode(': ',trim($line)); $property[$key] = $value; } $properties[] = $property; } return $all ? $properties : $properties[0]??null; } 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; } function customTiles($column) { global $mytiles; if (isset($mytiles)) foreach ($mytiles as $tile) if (!empty($tile[$column])) echo $tile[$column]; } // adjust the text color in log window $fgcolor = in_array($theme,['white','azure']) ? '#1c1c1c' : '#f2f2f2'; exec("sed -ri 's/^\.logLine\{color:#......;/.logLine{color:$fgcolor;/' $docroot/plugins/dynamix.docker.manager/log.htm >/dev/null &"); $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($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($var,'mdResync'); $mover = file_exists('/var/run/mover.pid'); $btrfs = exec('pgrep -cf /sbin/btrfs'); $dot = _var($display,'number','.,')[0]; $zfs = file_exists('/proc/spl/kstat/zfs/arcstats'); foreach ($disks as $disk) { switch (_var($disk,'type')) { case 'Data': if (isset($disk['fsFree'])) { $array_size += _var($disk,'fsSize',0); $array_used += _var($disk,'fsSize',0)-_var($disk,'fsFree',0); } break; case 'Cache': $name = _var($disk,'name'); if (in_array($name,$pools)) { $cache_size[$name] = _var($disk,'fsSize',0); $cache_used[$name] = _var($disk,'fsSize',0)-_var($disk,'fsFree',0); $cache_type[$name] = _var($disk,'rotational') ? (_var($disk,'luksState') ? 'disk-encrypted' : 'disk') : 'nvme'; $cache_rate[$name] = number_format(100*$cache_used[$name]/($cache_size[$name] ?: 1),1,$dot,''); if (empty($disks[$name]['devices'])) unset($pools[array_search($name,$pools)]); } break; } } foreach ($devs as $disk) { $extra_size += _var($disk,'sectors',0)*_var($disk,'sector_size',0); } $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($var,'shareSMBEnabled')=='yes' | _var($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'] ?? "").' '.(isset($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'].(isset($bios['Version']) ? ", "._("Version")." ".$bios['Version'] : ""); $cpu = dmidecode('Processor Information','4',0); $cpumodel = str_ireplace(["Processor","(C)","(R)","(TM)"],["","©","®","™"],$cpu['Version'] ?? exec("grep -Pom1 'model name\s+:\s*\K.+' /proc/cpuinfo")); $cpumodel .= (strpos($cpumodel,'@')===false && !empty($cpu['Current Speed']) ? " @ {$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] = my_explode(' ',$device['Size']??''); $base = array_search($unit,$sizes); if ($base!==false) $memory_installed += $size*pow(1024,$base); if (!$memory_type && isset($device['Type']) && $device['Type']!='Unknown') $memory_type = $device['Type']; } $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))); 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; } ?> ">
| =_var($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($var,'COMMENT')?> =_var($var,'SYS_MODEL')?> _(Registration)_ Unraid OS =_var($var,'regTy')?> _(Uptime)_ | |
_(Motherboard)_
| |
| =$board?> =$bios?> =$biosdate?> | |
_(Processor)_
| |
| =$cpumodel?> | |
| _(Overall Load)_:0% | |
| _(Show details)_ | |
| CPU $cpu1 - HT $cpu20% 0% | ";
else
echo "CPU $cpu10% | ";
echo "
_(Memory)_
="$memory_installed $unit $memory_type $ecc"?> | |
| _(Usable size)_: =my_scale($total,$unit,1,null,1024)." $unit"?>_(Maximum size)_: ="$memory_maximum $unit"?>=$low?'*':''?> | |
| _(RAM)_0% | |
| _(ZFS)_0% | |
| _(Flash)_0% | |
| _(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 Model)_: | |
| _(UPS status)_: | |
| _(UPS Load)_: | |
| _(Battery charge)_: | |
| _(Runtime left)_: | |
| _(Nominal power)_: | |
| _(Output voltage)_: | |
_(Airflow)_
_(Fan count)_: =$fans?> | |
| ";
for ($i = 0; $i < count($label); $i++) {
foreach ($label[$i] as $data) echo $data;
echo " "; foreach ($value[$i] as $data) echo $data; echo " "; if ($i < count($value)-1) echo " "; } echo " |
| _(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 |
| "._("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-- |