From 00328cbd0aa5f15394cb66819667742fcdafe71d Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Fri, 14 Aug 2026 21:36:30 -0400 Subject: [PATCH] Report network throughput in bits, which is what everything downstream says MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /proc/net/dev counts octets; the field is named rx_bps, vvFmtBps renders Kb/s and Mb/s, and the Monitor card prints it directly under the NIC link speed from /sys/class/net/*/speed, which genuinely is megabits. So the one figure you would read against the link understated traffic eightfold — 811 KB/s shown as "0.8 Mb/s" beside a 10 Gb/s link when it was 6.5. Converted at the source so the field name stops lying; both consumers are bit-labelled or relative. --- Plugin/unraid/include/common.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Plugin/unraid/include/common.php b/Plugin/unraid/include/common.php index bdccdb0..96293c8 100644 --- a/Plugin/unraid/include/common.php +++ b/Plugin/unraid/include/common.php @@ -394,10 +394,21 @@ function vv_network_stats(): array { file_put_contents($tmp, json_encode($now)); rename($tmp, $stateFile); + // ×8, because /proc/net/dev counts octets and everything downstream of here says bits. + // + // The field is named rx_bps, vvFmtBps() renders it as Kb/s, Mb/s and Gb/s, and the Monitor + // card prints it directly beneath the NIC's link speed — which comes from + // /sys/class/net/*/speed and genuinely is megabits. So the one number on that card you would + // read against the link was understating traffic by a factor of eight: 811 KB/s of real + // traffic displayed as "0.8 Mb/s" next to a 10 Gb/s link, when it was 6.5 Mb/s. + // + // Converted at the source rather than in the formatter so the field name stops lying. Both + // consumers are the Monitor card's rate readout and its history graph, and both are relative + // or bit-labelled, so neither changes meaning — only magnitude, to the correct one. $rxRate = $txRate = 0; if (!empty($prev['ts']) && ($dt = $now['ts'] - $prev['ts']) > 0.1) { - $rxRate = max(0, (int)(($rxBytes - ($prev['rx'] ?? $rxBytes)) / $dt)); - $txRate = max(0, (int)(($txBytes - ($prev['tx'] ?? $txBytes)) / $dt)); + $rxRate = max(0, (int)(($rxBytes - ($prev['rx'] ?? $rxBytes)) * 8 / $dt)); + $txRate = max(0, (int)(($txBytes - ($prev['tx'] ?? $txBytes)) * 8 / $dt)); } $speedMbps = (int)@file_get_contents("/sys/class/net/$iface/speed");