Files
homelab-scripts/zabbix_agent.sh
2018-06-07 10:35:15 -04:00

29 lines
922 B
Bash

#!/bin/bash
# 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"
ZABBIX_SERVER = "gauntzabbix.home.johnhgaunt.com"
# update the cache
apt update
# install the agent
apt install zabbix-agent
# ask for the hostname
read -p 'Hostname: ' hostname
sed -i '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 -i 's/ServerActive=127.0.0.1/ServerActive=${ZABBIX_SERVER}/' /etc/zabbix/zabbix_agentd.conf
systemctl restart zabbix-agent
systemctl enable zabbix-agent