Skip to content

Commit 5a27204

Browse files
osedlbauerJenkins
authored andcommitted
16927 FIX lnx_bonding failing with 'head: *: No such file or directory' if no bonding interface is configured
CMK-32474 closes: #900 Change-Id: Icaece69306a5be172ee49218e288aae15fef78fa
1 parent 9994e65 commit 5a27204

3 files changed

Lines changed: 26 additions & 2 deletions

File tree

.werks/16927.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[//]: # (werk v3)
2+
# lnx_bonding failing with 'head: *: No such file or directory' if no bonding interface is configured
3+
4+
key | value
5+
---------- | ---
6+
date | 2026-07-22T07:20:07.799324+00:00
7+
version | 3.0.0b1
8+
class | fix
9+
edition | community
10+
component | checks
11+
level | 1
12+
compatible | yes
13+
14+
The Linux and OpenWrt agents collect bonding information by reading the files
15+
in <tt>/proc/net/bonding</tt>. This directory exists whenever the bonding
16+
kernel module is loaded, even if no bonding interface is actually configured.
17+
18+
In that case the directory is empty, and the agent tried to run
19+
<tt>head</tt> on an unmatched shell glob. This wrote an error such as
20+
<tt>head: ./*: No such file or directory</tt> to the agent output.
21+
22+
The agents now only read the bonding files when at least one bonding
23+
interface is present, so no spurious error is emitted.
24+

agents/check_mk_agent.linux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ section_bonding_interfaces() {
903903
(
904904
cd /proc/net/bonding 2>/dev/null || return
905905
echo '<<<lnx_bonding:sep(58)>>>'
906-
head -v -n 1000 ./*
906+
[ -n "$(ls)" ] && head -v -n 1000 ./*
907907
)
908908
}
909909

agents/check_mk_agent.openwrt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ section_bonding_interfaces() {
581581
(
582582
cd /proc/net/bonding 2>/dev/null || return
583583
echo '<<<lnx_bonding:sep(58)>>>'
584-
head -v -n 1000 ./*
584+
[ -n "$(ls)" ] && head -v -n 1000 ./*
585585
)
586586
}
587587

0 commit comments

Comments
 (0)