# ------------------------------------------------------------------------------ # Install check_mk agent using xinetd superserver # This file is part of the init.sh project # Copyright (c) 2019-2021 Geoffray Levasseur # ------------------------------------------------------------------------------ # This file is distributed under 3-clause BSD license. # The complete license agreement can be obtained at: # https://opensource.org/licenses/BSD-3-Clause # ------------------------------------------------------------------------------ # Variable: # * MK_SERVER: Server IP address # * MK_PORT: Port check_mk agent will use to communicate with server # ------------------------------------------------------------------------------ export VER_install_mkagent="0.0.6" export DEP_install_mkagent="upgrade_dist install_pkg" install_mkagent() { wget $MK_URL -O /tmp/check-mk-agent_${MK_VERSION}_all.deb pkginst xinetd /tmp/check-mk-agent_${MK_VERSION}_all.deb rm /tmp/check-mk-agent_${MK_VERSION}_all.deb backup_dist /etc/xinetd.d/check_mk install_file cmk/check_mk /etc/xinetd.d/check_mk tag_file /etc/xinetd.d/check_mk sed -i -e "s/@MK_SERVER_IP@/$MK_SERVER_IP/" /etc/xinetd.d/check_mk mkdir -pv /usr/lib/check_mk_agent/plugins/28800 install_file cmk/mk_apt /usr/lib/check_mk_agent/plugins/28800/mk_apt svc_restart xinetd } precheck_install_mkagent() { if [[ -z $MK_VERSION ]]; then prnt E "Undeclared check_mk version of the agent to install." die 162 fi if [[ -z $MK_URL ]]; then prnt E "Undeclared check_mk download URL." die 162 fi if [[ -z $MK_SERVER_IP ]]; then prnt E "Undeclared check_mk server." die 162 fi file_must_exists cmk/check_mk cmk/mk_apt } export -f install_mkagent export -f precheck_install_mkagent # EOF