From 11c56aa0580f03aa171276e2b74f92f87eb9a23a Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 21 Dec 2025 10:18:59 +0100 Subject: [PATCH] OpenWrt agent: get interface speed from sysfs if ethtool is missing ethtool is not default on most OpenWrt targets and these devices are typically found in networking environments, so missing interface speed is not the desired behavior. Adapt fallback from Linux agent and extract speed from sysfs if ethtool is not available. --- agents/check_mk_agent.openwrt | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/agents/check_mk_agent.openwrt b/agents/check_mk_agent.openwrt index 13c9957833f..300c8acbf5b 100755 --- a/agents/check_mk_agent.openwrt +++ b/agents/check_mk_agent.openwrt @@ -561,13 +561,19 @@ section_lnx_if() { echo '<<>>' sed 1,2d /proc/net/dev - if inpath ethtool; then - sed -e 1,2d /proc/net/dev | cut -d':' -f1 | sort | while read -r eth; do - echo "[${eth}]" - ethtool "${eth}" | grep -E '(Speed|Duplex|Link detected|Auto-negotiation):' - echo "Address: $(cat "/sys/class/net/${eth}/address")" - done - fi + sed -e 1,2d /proc/net/dev | cut -d':' -f1 | sort | while read -r eth; do + echo "[${eth}]" + if inpath ethtool; then + ethtool "${eth}" | grep -E '(Speed|Duplex|Link detected|Auto-negotiation):' + else + speed=$(cat "/sys/class/net/${eth}/speed" 2>/dev/null) + if [ -n "${speed}" ] && [ "${speed}" -ge 0 ]; then + echo "Speed: ${speed}Mb/s" + fi + fi + echo "Address: $(cat "/sys/class/net/${eth}/address")" + done + } # Current state of bonding interfaces