mirror of
https://github.com/unraid/webgui.git
synced 2026-02-25 03:38:44 -06:00
Dashboard: add hover feature to system resources
This commit is contained in:
@@ -27,7 +27,7 @@ $md5_old = -1;
|
||||
while (true) {
|
||||
unset($memory,$df,$zfs,$fans,$lsof,$meminfo,$sysinfo);
|
||||
exec("awk '/^Mem(Total|Available)/{print $2*1024}' /proc/meminfo",$memory);
|
||||
exec("df --output=pcent,used /boot /var/log /var/lib/docker|awk '(NR>1){print $1,$2*1024}'",$df);
|
||||
exec("df --output=pcent,used /boot /var/log /var/lib/docker 2>/dev/null|awk '(NR>1){print $1,$2*1024}'",$df);
|
||||
exec("sensors -uA 2>/dev/null|grep -Po 'fan\d_input: \K\d+'",$fans);
|
||||
$zfs = exec("awk '/^size/{print \$3;exit}' /proc/spl/kstat/zfs/arcstats 2>/dev/null")?:0;
|
||||
[$total,$free] = $memory;
|
||||
@@ -39,12 +39,11 @@ while (true) {
|
||||
[$pcent,$used] = explode(' ',$data);
|
||||
$sysinfo[] = $pcent.';'.my_scale($used,$unit,null,-1,1024)." $unit";
|
||||
}
|
||||
$fans = count($fans) ? implode(" RPM\0",$fans).' RPM' : '';
|
||||
$name = array_keys((array)parse_ini_file("$varroot/shares.ini"));
|
||||
exec("LANG='en_US.UTF8' lsof -Owl /mnt/disk[0-9]* 2>/dev/null|awk '/^shfs/ && \$0!~/\.AppleD(B|ouble)/ && \$5==\"REG\"'|awk -F/ '{print \$4}'",$lsof);
|
||||
$counts = array_count_values($lsof); $count = [];
|
||||
foreach ($name as $share) $count[] = $counts[$share] ?? 0;
|
||||
$echo = implode(";",$meminfo).implode("\0",$sysinfo)."\1$fans\1".implode("\0",$count);
|
||||
$echo = implode(";",$meminfo).implode("\0",$sysinfo)."\1".(count($fans)?implode(" RPM\0",$fans).' RPM':'')."\1".implode("\0",$count);
|
||||
$md5_new = md5($echo,true);
|
||||
if ($md5_new !== $md5_old) {
|
||||
publish('update1', $echo);
|
||||
|
||||
Reference in New Issue
Block a user