From b1932b1f7d7896254f9880d7e071a7a8cbd6b046 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Fri, 21 Jun 2024 17:06:00 +0200 Subject: [PATCH] 17237 FIX check_mk_agent.openwrt: resolve issue when hostname command unavailable Built-in BusyBox shell in OpenWRT has no `hostname` command available per default. While it can be added with additional packages in custom images there are alternative ways to determine the machine's hostname without introducing an additional dependency. This werk uses one of those alternatives. Closes: #721 Change-Id: Ib05f837151f02942077a5b405dab966e7f4f9318 --- .werks/17237 | 13 +++++++++++++ agents/check_mk_agent.openwrt | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 .werks/17237 diff --git a/.werks/17237 b/.werks/17237 new file mode 100644 index 00000000000..1d401d696ca --- /dev/null +++ b/.werks/17237 @@ -0,0 +1,13 @@ +Title: check_mk_agent.openwrt: resolve issue when hostname command unavailable +Class: fix +Compatible: compat +Component: checks +Date: 1731050041 +Edition: cre +Level: 1 +Version: 2.2.0p37 + +Built-in BusyBox shell in OpenWRT has no hostname command available per default. +While it can be added with additional packages in custom images there are alternative +ways to determine the machine's hostname without introducing an additional dependency. +This werk uses one of those alternatives. diff --git a/agents/check_mk_agent.openwrt b/agents/check_mk_agent.openwrt index 6ae4635a38f..eedd0d24703 100755 --- a/agents/check_mk_agent.openwrt +++ b/agents/check_mk_agent.openwrt @@ -272,7 +272,7 @@ section_checkmk() { echo "<<>>" echo "Version: 2.2.0p37" echo "AgentOS: openwrt" - echo "Hostname: $(hostname)" + echo "Hostname: $(cat /proc/sys/kernel/hostname)" echo "AgentDirectory: ${MK_CONFDIR}" echo "DataDirectory: ${MK_VARDIR}" echo "SpoolDirectory: ${SPOOLDIR}" @@ -848,7 +848,7 @@ section_veritas_vcs() { # Secure mode must be off to allow root to execute commands if [ -x /opt/VRTSvcs/bin/haclus ]; then echo "<<>>" - vcshost=$(hostname | cut -d. -f1) + vcshost=$(cut -d. -f1