Skip to content

Commit

Permalink
17237 FIX check_mk_agent.openwrt: resolve issue when hostname command…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
stklcode authored and anthonyh209 committed Nov 11, 2024
1 parent 99a3cac commit b1932b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions .werks/17237
Original file line number Diff line number Diff line change
@@ -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 <code>hostname</code> 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.
4 changes: 2 additions & 2 deletions agents/check_mk_agent.openwrt
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ section_checkmk() {
echo "<<<check_mk>>>"
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}"
Expand Down Expand Up @@ -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 "<<<veritas_vcs>>>"
vcshost=$(hostname | cut -d. -f1)
vcshost=$(cut -d. -f1 </proc/sys/kernel/hostname)
waitmax -s 9 2 /opt/VRTSvcs/bin/haclus -display -localclus | grep -e ClusterName -e ClusState
waitmax -s 9 2 /opt/VRTSvcs/bin/hasys -display -attribute SysState
waitmax -s 9 2 /opt/VRTSvcs/bin/hagrp -display -sys "${vcshost}" -attribute State -localclus
Expand Down

0 comments on commit b1932b1

Please sign in to comment.