diff --git a/init.sh b/init.sh index 29814e8..342cedd 100755 --- a/init.sh +++ b/init.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # ------------------------------------------------------------------------------ # Init.sh: initialise a computer and conform it -# Copyright (c) 2019-2021 Geoffray Levasseur +# Copyright (c) 2019-2023 Geoffray Levasseur # ------------------------------------------------------------------------------ # This file is distributed under 3-clause BSD license. # The complete license agreement can be obtained at: diff --git a/modules/install_mkagent.sh b/modules/install_mkagent.sh index 12e0dbc..9f0144e 100644 --- a/modules/install_mkagent.sh +++ b/modules/install_mkagent.sh @@ -1,7 +1,7 @@ # ------------------------------------------------------------------------------ # Install check_mk agent using xinetd superserver # This file is part of the init.sh project -# Copyright (c) 2019-2022 Geoffray Levasseur +# Copyright (c) 2019-2023 Geoffray Levasseur # ------------------------------------------------------------------------------ # This file is distributed under 3-clause BSD license. # The complete license agreement can be obtained at: @@ -28,6 +28,16 @@ install_mkagent() mkdir -pv /usr/lib/check_mk_agent/plugins/28800 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 }