removed agent url and fixed username variable

This commit is contained in:
2024-11-15 17:04:27 +00:00
parent 3c6b64a744
commit 1e1a6b18e9

View File

@@ -7,11 +7,10 @@ if [ "$EUID" -ne 0 ]; then
fi fi
# ask for the domain, username, and password # 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 Server: " -i "gauntcheckmk.home.johnhgaunt.com" CHECK_MK_SERVER
read -e -p "Enter Checkmk Agent Server: " -i "gauntcheckmk.home.johnhgaunt.com" CHECK_MK_AGENT_SERVER
read -e -p "Enter Checkmk Site Name: " -i "gaunt" SITE_NAME read -e -p "Enter Checkmk Site Name: " -i "gaunt" SITE_NAME
read -e -p "Enter Checkmk Username: " -i "automation" USERNAME read -e -p "Enter Checkmk Username: " -i "automation" USERNAME
read -e -s -p "Enter ${USERNMAE}'s Password: " PASSWORD read -e -s -p "Enter ${USERNAME}'s Password: " PASSWORD
# get OS ditro and version # get OS ditro and version
@@ -33,7 +32,7 @@ set -e
# set -x # set -x
API_URL="http://${CHECK_MK_SERVER}/${SITE_NAME}/check_mk/api/1.0" API_URL="http://${CHECK_MK_SERVER}/${SITE_NAME}/check_mk/api/1.0"
AUTHORIZATION_HEADER="Authorization: Bearer ${USERNMAE} ${PASSWORD}" AUTHORIZATION_HEADER="Authorization: Bearer ${USERNAME} ${PASSWORD}"
read -e -p "Enter Hostname: " -i "$(cat /etc/hostname)" HOSTNAME read -e -p "Enter Hostname: " -i "$(cat /etc/hostname)" HOSTNAME
tmpdir=$(mktemp -d) tmpdir=$(mktemp -d)
@@ -103,8 +102,8 @@ if [ "${VM}" == "false" ]; then
fi fi
/usr/bin/cmk-agent-ctl register --hostname ${HOSTNAME} \ /usr/bin/cmk-agent-ctl register --hostname ${HOSTNAME} \
--server ${CHECK_MK_AGENT_SERVER} --site ${SITE_NAME} \ --server ${CHECK_MK_SERVER} --site ${SITE_NAME} \
--user ${USERNMAE} --password ${PASSWORD} \ --user ${USERNAME} --password ${PASSWORD} \
--trust-cert --trust-cert
sleep 15s sleep 15s