Updated to ask for input for server details instead of hard coded and arguments

This commit is contained in:
2024-11-14 13:24:22 +00:00
parent 6232ea9d51
commit 6500972c6b

View File

@@ -6,6 +6,13 @@ if [ "$EUID" -ne 0 ]; then
exit
fi
# ask for the domain, username, and password
read -e -p "Enter Checkmk Server: " -i "checkmk.johnhgaunt.com" CHECK_MK_SERVER
read -e -p "Enter Checkmk Site Name: " -i "gaunt" SITE_NAME
read -e -p "Enter Checkmk Username: " -i "automation" USERNMAE
read -e -s -p "Enter ${USERNMAE}'s Password: " PASSWORD
# get OS ditro and version
OS=$(hostnamectl | awk '/Operating System/ {print $3}')
VM=$(hostnamectl | awk '/Virtualization/ {print $2}')
@@ -24,11 +31,7 @@ fi
set -e
# set -x
CHECK_MK_SERVER="gauntcheckmk.home.johnhgaunt.com"
SITE_NAME="gaunt"
API_URL="http://${CHECK_MK_SERVER}/${SITE_NAME}/check_mk/api/1.0"
USERNMAE="automation"
PASSWORD="$1"
AUTHORIZATION_HEADER="Authorization: Bearer ${USERNMAE} ${PASSWORD}"
read -e -p "Enter Hostname: " -i "$(cat /etc/hostname)" HOSTNAME
@@ -40,7 +43,7 @@ if [ -x /usr/bin/dpkg ]; then
if dpkg -l check-mk-agent > /dev/null; then
dpkg -P check-mk-agent
fi
apt-get install xinetd curl
apt-get install xinetd curl -y
dpkg -i ${tmpfile}
# Apt
wget -O /usr/lib/check_mk_agent/plugins/mk_apt http://${CHECK_MK_SERVER}/${SITE_NAME}/check_mk/agents/plugins/mk_apt