From d7210fd7a0cceaffd153673d259a0b70d4b30ce5 Mon Sep 17 00:00:00 2001 From: Oliver Sedlbauer Date: Fri, 13 Mar 2026 15:42:48 +0100 Subject: [PATCH] agents: fix lnx_bonding when no bonding interface is configured When /proc/net/bonding exists but no bonding interface is configured, head fails with: head: *: No such file or directory Fix this by checking if any interfaces exist before running head Signed-off-by: Oliver Sedlbauer --- agents/check_mk_agent.linux | 2 +- agents/check_mk_agent.openwrt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux index 810cd2817e1..fdc77abaeb4 100755 --- a/agents/check_mk_agent.linux +++ b/agents/check_mk_agent.linux @@ -857,7 +857,7 @@ section_bonding_interfaces() { ( cd /proc/net/bonding 2>/dev/null || return echo '<<>>' - head -v -n 1000 ./* + [ -n "$(ls)" ] && head -v -n 1000 ./* ) } diff --git a/agents/check_mk_agent.openwrt b/agents/check_mk_agent.openwrt index a40c05d7137..f02d506bdf5 100755 --- a/agents/check_mk_agent.openwrt +++ b/agents/check_mk_agent.openwrt @@ -581,7 +581,7 @@ section_bonding_interfaces() { ( cd /proc/net/bonding 2>/dev/null || return echo '<<>>' - head -v -n 1000 ./* + [ -n "$(ls)" ] && head -v -n 1000 ./* ) }