Skip to content

Commit d7210fd

Browse files
committed
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 <os@dev.tdt.de>
1 parent 1351908 commit d7210fd

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

agents/check_mk_agent.linux

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ section_bonding_interfaces() {
857857
(
858858
cd /proc/net/bonding 2>/dev/null || return
859859
echo '<<<lnx_bonding:sep(58)>>>'
860-
head -v -n 1000 ./*
860+
[ -n "$(ls)" ] && head -v -n 1000 ./*
861861
)
862862
}
863863

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)