add support for check_mk >= 2.1 with registration

This commit is contained in:
2023-10-27 22:46:11 +02:00
parent 89fcbd4f05
commit 57a92bf640
2 changed files with 12 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Init.sh: initialise a computer and conform it # Init.sh: initialise a computer and conform it
# Copyright (c) 2019-2021 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org> # Copyright (c) 2019-2023 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# This file is distributed under 3-clause BSD license. # This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at: # The complete license agreement can be obtained at:

View File

@@ -1,7 +1,7 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Install check_mk agent using xinetd superserver # Install check_mk agent using xinetd superserver
# This file is part of the init.sh project # This file is part of the init.sh project
# Copyright (c) 2019-2022 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org> # Copyright (c) 2019-2023 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# This file is distributed under 3-clause BSD license. # This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at: # The complete license agreement can be obtained at:
@@ -28,6 +28,16 @@ install_mkagent()
mkdir -pv /usr/lib/check_mk_agent/plugins/28800 mkdir -pv /usr/lib/check_mk_agent/plugins/28800
install_file cmk/mk_apt /usr/lib/check_mk_agent/plugins/28800/mk_apt install_file cmk/mk_apt /usr/lib/check_mk_agent/plugins/28800/mk_apt
# Cmk > 2.1, configure agent
if [[ -e /var/lib/cmk-agent/cmk-agent-ctl.gz ]]; then
gunzip /var/lib/cmk-agent/cmk-agent-ctl.gz
chmod +x /var/lib/cmk-agent/cmk-agent-ctl
scp -O $MK_SERVER_IP:/etc/check_mk/agentpwd /tmp/mk-pwd
/var/lib/cmk-agent/cmk-agent-ctl register --hostname $HOSTNAME \
--server $MK_SERVER_IP --site check_mk --user check_mk --password \
"$(read /etc/mk-pwd)"
fi
svc_restart xinetd svc_restart xinetd
} }