Updated to ask for input for server details instead of hard coded and arguments
This commit is contained in:
13
checkmk.sh
13
checkmk.sh
@@ -6,6 +6,13 @@ if [ "$EUID" -ne 0 ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
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
|
# get OS ditro and version
|
||||||
OS=$(hostnamectl | awk '/Operating System/ {print $3}')
|
OS=$(hostnamectl | awk '/Operating System/ {print $3}')
|
||||||
VM=$(hostnamectl | awk '/Virtualization/ {print $2}')
|
VM=$(hostnamectl | awk '/Virtualization/ {print $2}')
|
||||||
@@ -24,11 +31,7 @@ fi
|
|||||||
set -e
|
set -e
|
||||||
# set -x
|
# 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"
|
API_URL="http://${CHECK_MK_SERVER}/${SITE_NAME}/check_mk/api/1.0"
|
||||||
USERNMAE="automation"
|
|
||||||
PASSWORD="$1"
|
|
||||||
AUTHORIZATION_HEADER="Authorization: Bearer ${USERNMAE} ${PASSWORD}"
|
AUTHORIZATION_HEADER="Authorization: Bearer ${USERNMAE} ${PASSWORD}"
|
||||||
read -e -p "Enter Hostname: " -i "$(cat /etc/hostname)" HOSTNAME
|
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
|
if dpkg -l check-mk-agent > /dev/null; then
|
||||||
dpkg -P check-mk-agent
|
dpkg -P check-mk-agent
|
||||||
fi
|
fi
|
||||||
apt-get install xinetd curl
|
apt-get install xinetd curl -y
|
||||||
dpkg -i ${tmpfile}
|
dpkg -i ${tmpfile}
|
||||||
# Apt
|
# Apt
|
||||||
wget -O /usr/lib/check_mk_agent/plugins/mk_apt http://${CHECK_MK_SERVER}/${SITE_NAME}/check_mk/agents/plugins/mk_apt
|
wget -O /usr/lib/check_mk_agent/plugins/mk_apt http://${CHECK_MK_SERVER}/${SITE_NAME}/check_mk/agents/plugins/mk_apt
|
||||||
|
|||||||
Reference in New Issue
Block a user