first commit
This commit is contained in:
2
README.md
Normal file
2
README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# Simple Script to install Zabbix Agent 2 on VM or LXC
|
||||
[https://www.zabbix.com/]()
|
||||
28
zabbix-setup.sh
Normal file
28
zabbix-setup.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
wget https://repo.zabbix.com/zabbix/5.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.2-1+ubuntu20.04_all.deb
|
||||
dpkg -i zabbix-release_5.2-1+ubuntu20.04_all.deb
|
||||
apt update
|
||||
apt install zabbix-agent2 curl -y
|
||||
sed -i 's/Server=127.0.0.1/Server=zabbix.vmlan/g' /etc/zabbix/zabbix_agent2.conf
|
||||
sed -i 's/ServerActive=127.0.0.1/ServerActive=zabbix.vmlan/g' /etc/zabbix/zabbix_agent2.conf
|
||||
sed -i 's/Hostname=Zabbix server/Hostname='$(hostname)'.vmlan/g' /etc/zabbix/zabbix_agent2.conf
|
||||
|
||||
|
||||
lxc=$(systemd-detect-virt | grep lxc)
|
||||
|
||||
if [ $lxc = lxc ]; then
|
||||
echo "I'm inside matrix ;(";
|
||||
curl -o /etc/zabbix/zabbix_agent2.d/zabbix_container.conf https://raw.githubusercontent.com/kvaps/zabbix-linux-container-template/master/zabbix_container.conf && systemctl restart zabbix-agent2
|
||||
else
|
||||
echo "I'm living in real world!";
|
||||
fi
|
||||
|
||||
|
||||
|
||||
systemctl enable zabbix-agent2
|
||||
systemctl start zabbix-agent2
|
||||
systemctl restart zabbix-agent2
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user