From bc516dadc4866b1d0120cc59fa545b33c86fb8a1 Mon Sep 17 00:00:00 2001 From: "Gaunt, John" Date: Thu, 7 Jun 2018 10:48:39 -0400 Subject: [PATCH] updates --- zabbix_agent.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/zabbix_agent.sh b/zabbix_agent.sh index 1f1de98..e635ca2 100644 --- a/zabbix_agent.sh +++ b/zabbix_agent.sh @@ -2,11 +2,21 @@ # installs the zabbix agent and configures it -DEBIAN_URL = "https://repo.zabbix.com/zabbix/3.5/debian/pool/main/z/zabbix-release/zabbix-release_3.5-1%2Bstretch_all.deb" -CENTOS_URL = "https://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm" -UBUNTU_URL = "https://repo.zabbix.com/zabbix/3.5/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.5-1%2Bbionic_all.deb" +# create temp directory for downloaded files +DIRECTORY="/tmp/zabbix_install" +mkdir ${DIRECTORY} -ZABBIX_SERVER = "gauntzabbix.home.johnhgaunt.com" +# download the correct file for the correct OS +FILENAME="zabbix_repo.deb" +DEBIAN_URL="https://repo.zabbix.com/zabbix/3.5/debian/pool/main/z/zabbix-release/zabbix-release_3.5-1%2Bstretch_all.deb" +#CENTOS_URL="https://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm" +#UBUNTU_URL="https://repo.zabbix.com/zabbix/3.5/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.5-1%2Bbionic_all.deb" +wget --output-document=${DIRECTORY}/${FILENAME} $DEBIAN_URL + +# install the repo +dpkg -i ${DIRECTORY}/${FILENAME} + +ZABBIX_SERVER="gauntzabbix.home.johnhgaunt.com" # update the cache apt update @@ -15,7 +25,7 @@ apt update apt install zabbix-agent # ask for the hostname -read -p 'Hostname: ' hostname +read -e -p "Enter Hostname: " -i "$(cat /etc/hostname)" hostname sed -i 's/Hostname=Zabbix\ server/Hostname=${hostname}/' /etc/zabbix/zabbix_agentd.conf @@ -25,4 +35,4 @@ sed -i 's/ServerActive=127.0.0.1/ServerActive=${ZABBIX_SERVER}/' /etc/zabbix/zab systemctl restart zabbix-agent -systemctl enable zabbix-agent +systemctl enable zabbix-agent \ No newline at end of file