Here is how you add the Zabbix agent to an Ubuntu v22 machine.
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
set -e
# Zabbix server IP address or FQDN
Z_SERVER_IP=192.168.1.94
wget https://repo.zabbix.com/zabbix/6.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.2-4%2Bubuntu22.04_all.deb
sudo dpkg -i zabbix-release_6.2-4+ubuntu22.04_all.deb
rm zabbix-release_6.2-4+ubuntu22.04_all.deb
sudo apt-get update
sudo apt -y install zabbix-agent
sudo sed -i "s/^Server=127.0.0.1$/Server=$Z_SERVER_IP/g" /etc/zabbix/zabbix_agentd.conf
sudo sed -i "s/^ServerActive=127.0.0.1$/ServerActive=$Z_SERVER_IP:10051/g" /etc/zabbix/zabbix_agentd.conf
sudo sed -i "s/^Hostname=Zabbix server$/Hostname=$(hostname)/g" /etc/zabbix/zabbix_agentd.conf
sudo sed -i "s/^# ListenPort=10050$/ListenPort=10050/g" /etc/zabbix/zabbix_agentd.conf
sudo sed -i "s/^# ListenIP=0.0.0.0$/ListenIP=0.0.0.0/g" /etc/zabbix/zabbix_agentd.conf
sudo systemctl enable zabbix-agent
sudo systemctl start zabbix-agent