From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 09C541FF14C for ; Fri, 15 May 2026 10:39:41 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D987310434; Fri, 15 May 2026 10:39:40 +0200 (CEST) From: Erik Fastermann To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup v3] fix #7187: report: add ethtool output for physical interfaces Date: Fri, 15 May 2026 10:39:18 +0200 Message-ID: <20260515083918.10590-1-e.fastermann@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.025 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Message-ID-Hash: YGMACJNN5FTGYD3IRUJXJO523X2NFYZG X-Message-ID-Hash: YGMACJNN5FTGYD3IRUJXJO523X2NFYZG X-MailFrom: root@erik-test-pbs.proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Erik Fastermann X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Adding ethtool output to the report provides visibility into actual and supported NIC link speeds, making it much easier to diagnose network performance issues, negotiation failures, and configuration mismatches. It also reduces support back-and-forth. Signed-off-by: Erik Fastermann --- NOTE: A similar patch was submitted for all products: pmg, pve, pbs, pdm. changes since v2: * added new function dynamic_commands * updated generate_report to include the dynamic_commands NOTE: I did not change the signature of get_command_output, as the suggested fix does not work in this case, because we later join the args for the output. This is why solutions like &[impl AsRef] also don't work. Mapping the Vec to Vec<&str> seamed like the simplest change, but I'm open to other suggestions. src/server/report.rs | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/server/report.rs b/src/server/report.rs index e4c761cdb..297718d2e 100644 --- a/src/server/report.rs +++ b/src/server/report.rs @@ -2,6 +2,8 @@ use std::fmt::Write; use std::path::Path; use std::process::Command; +use proxmox_network_api::NetworkInterfaceType; + fn get_top_processes() -> String { let (exe, args) = ("top", vec!["-b", "-c", "-w512", "-n", "1", "-o", "TIME"]); let output = Command::new(exe).args(&args).output(); @@ -93,6 +95,25 @@ fn commands() -> Vec<(&'static str, Vec<&'static str>)> { ] } +fn dynamic_commands() -> Vec<(&'static str, Vec)> { + let mut commands = Vec::new(); + + match proxmox_network_api::config() { + Ok((config, _)) => { + for (name, iface) in config.interfaces { + if iface.interface_type == NetworkInterfaceType::Eth { + commands.push(("ethtool", vec![name])); + } + } + } + Err(err) => { + eprintln!("failed to query network interfaces: {err}"); + } + } + + commands +} + // (description, function()) type FunctionMapping = (&'static str, fn() -> String); @@ -206,9 +227,17 @@ pub fn generate_report() -> String { .collect::>() .join("\n\n"); - let command_outputs = commands() - .iter() - .map(|(command, args)| get_command_output(command, args)) + let static_command_outputs = commands() + .into_iter() + .map(|(command, args)| get_command_output(command, &args)); + + let dynamic_command_outputs = dynamic_commands().into_iter().map(|(command, args)| { + let args = args.iter().map(String::as_str).collect(); + get_command_output(command, &args) + }); + + let command_outputs = static_command_outputs + .chain(dynamic_command_outputs) .collect::>() .join("\n\n"); -- 2.47.3