Files
init.sh/modules/install_mkagent.sh
2021-09-28 13:46:22 +02:00

43 lines
1.4 KiB
Bash

# ------------------------------------------------------------------------------
# Install check_mk agent using xinetd superserver
# This file is part of the init.sh project
# Copyright (c) 2019-2021 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
# ------------------------------------------------------------------------------
# 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.2"
export DEP_install_mkagent="upgrade_dist install_pkg"
install_mkagent()
{
pkginst $MYPATH/repo/mk_agents/check-mk-agent_${MKVERSION}_all.deb
backupdist /etc/xinetd.d/check_mk
installfile check_mk /etc/xinetd.d/check_mk
sed -i -e "s/@MK_SERVER@/$MK_SERVER/" /etc/xinetd.d/check_mk
svc_restart xinetd
}
precheck_install_mkagent()
{
if [[ -n $MKVERSION ]]; then
prnt E "Undeclared check_mk version of the agent to install."
die 162
fi
if [[ -n $MK_SERVER ]]; then
prnt E "Undeclared check_mk server."
die 162
fi
}
export -f install_mkagent
export -f precheck_install_mkagent
# EOF