From 303cc050c6149495d118f565a6cef76aec3648a5 Mon Sep 17 00:00:00 2001 From: bergware Date: Mon, 4 Dec 2023 13:38:23 +0100 Subject: [PATCH] Dashboard: add hover feature to system resources --- emhttp/plugins/dynamix/nchan/update_1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/emhttp/plugins/dynamix/nchan/update_1 b/emhttp/plugins/dynamix/nchan/update_1 index 7e92633c4..2dd422f3e 100755 --- a/emhttp/plugins/dynamix/nchan/update_1 +++ b/emhttp/plugins/dynamix/nchan/update_1 @@ -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);