forked from DOUBLE-TOP/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzabbix_agent.sh
23 lines (19 loc) · 1.07 KB
/
zabbix_agent.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# Установка зависимостей
sudo apt-get update
sudo apt-get install -y wget
# Загрузка и установка Zabbix agent
# echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
# sudo apt-get update
# sudo apt-get install libssl1.1 libldap2-dev -y
sudo wget https://repo.zabbix.com/zabbix/6.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.2-1+ubuntu20.04_all.deb
sudo dpkg -i zabbix-release_6.2-1+ubuntu20.04_all.deb
sudo apt-get update
sudo apt-get install -y zabbix-agent
# Настройка конфигурационного файла агента
sudo sed -i "s/Server=127.0.0.1/Server=$zabbix_server/g" /etc/zabbix/zabbix_agentd.conf
sudo sed -i "s/ServerActive=127.0.0.1/ServerActive=$zabbix_server/g" /etc/zabbix/zabbix_agentd.conf
sudo sed -i "s/Hostname=Zabbix server/Hostname=$profile/g" /etc/zabbix/zabbix_agentd.conf
# Включение и запуск агента с помощью systemd
sudo systemctl enable zabbix-agent
sudo systemctl start zabbix-agent