Update zabbix_agent.sh

This commit is contained in:
2018-06-13 11:00:02 -04:00
parent 7201234c78
commit ac61cd1c9b

View File

@@ -20,7 +20,7 @@ DEBIAN_URL="http://repo.zabbix.com/zabbix/3.4/debian/pool/main/z/zabbix-release/
wget --output-document=${DIRECTORY}/${FILENAME} $DEBIAN_URL
# install the repo
dpkg -i ${DIRECTORY}/${FILENAME}
dpkg --install ${DIRECTORY}/${FILENAME}
ZABBIX_SERVER="gauntzabbix.home.johnhgaunt.com"
@@ -28,16 +28,16 @@ ZABBIX_SERVER="gauntzabbix.home.johnhgaunt.com"
apt update
# install the agent
apt install -y zabbix-agent
apt install --assume-yes zabbix-agent
# ask for the hostname
read -e -p "Enter Hostname: " -i "$(cat /etc/hostname)" hostname
sed -i "s/Hostname=Zabbix\ server/Hostname=${hostname}/" /etc/zabbix/zabbix_agentd.conf
sed --in-place "s/^Hostname=Zabbix\ server/Hostname=${hostname}/" /etc/zabbix/zabbix_agentd.conf
sed -i "s/Server=127.0.0.1/Server=${ZABBIX_SERVER}/" /etc/zabbix/zabbix_agentd.conf
sed --in-place "s/^Server=127.0.0.1/Server=${ZABBIX_SERVER}/" /etc/zabbix/zabbix_agentd.conf
sed -i "s/ServerActive=127.0.0.1/ServerActive=${ZABBIX_SERVER}/" /etc/zabbix/zabbix_agentd.conf
sed --in-place "s/^ServerActive=127.0.0.1/ServerActive=${ZABBIX_SERVER}/" /etc/zabbix/zabbix_agentd.conf
systemctl restart zabbix-agent