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 89f5617 commit aefb22e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .werks/17237.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[//]: # (werk v2)
# check_mk_agent.openwrt: resolve issue when hostname command unavailable

key | value
---------- | ---
date | 2024-11-08T07:14:01+00:00
version | 2.4.0b1
class | fix
edition | cre
component | checks
level | 1
compatible | yes

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.
4 changes: 2 additions & 2 deletions agents/check_mk_agent.openwrt
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ section_checkmk() {
echo "<<<check_mk>>>"
echo "Version: 2.4.0b1"
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 @@ -948,7 +948,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 aefb22e

Please sign in to comment.