31 lines
907 B
Bash
31 lines
907 B
Bash
#!/bin/bash
|
|
|
|
#Install Zabbix Agent
|
|
|
|
ROOT_UID=0
|
|
|
|
if [ "$UID" -ne "$ROOT_UID" ]; then
|
|
echo -e "${RED}Please run script as root user.${DEFAULT}"; exit 1
|
|
fi
|
|
|
|
if [ -f /etc/zabbix ]; then
|
|
echo "Zabbix Agent Installed"
|
|
|
|
sed -i 's/Server=.*/Server=192.168.1.56/g' /etc/zabbix/zabbix_agentd.conf
|
|
sed -i 's/ServerActive=.*/ServerActive=192.168.1.56/g' /etc/zabbix/zabbix_agentd.conf
|
|
else
|
|
wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-2+ubuntu22.04_all.deb
|
|
dpkg -i zabbix-release_7.0-2+ubuntu22.04_all.deb
|
|
apt update
|
|
apt install zabbix-agent -y
|
|
|
|
systemctl restart zabbix-agent
|
|
systemctl enable zabbix-agent
|
|
|
|
sed -i 's/Server=127.0.0.1/Server=192.168.1.56/g' /etc/zabbix/zabbix_agentd.conf
|
|
sed -i 's/ServerActive=127.0.0.1/ServerActive=192.168.1.56/g' /etc/zabbix/zabbix_agentd.conf
|
|
fi
|
|
|
|
systemctl restart zabbix-agent
|
|
|
|
echo "Zabbix Agent Installed" |