This commit is contained in:
stirelshka8 2024-07-13 09:47:33 +03:00
parent 8cad8876d6
commit a5b12337a9
2 changed files with 31 additions and 0 deletions

0
.gitignore vendored Normal file
View File

31
install_agent.sh Normal file
View File

@ -0,0 +1,31 @@
#!/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"