Install Zabbix Agent Ubuntu

Ubuntu 20.04

sudo https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1%2Bfocal_all.deb
sudo apt update
sudo dpkg -i zabbix-release_5.0-1+focal_all.deb

Ubuntu 18.04

wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1%2Bbionic_all.deb
sudo apt update
dpkg -i zabbix-release_5.0-1+bionic_all.deb

Ubuntu 16.04

wget http://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1%2Bxenial_all.deb
sudo apt update
dpkg -i zabbix-release_5.0-1+xenial_all.deb

Ubuntu 14.04

wget http://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1%2Btrusty_all.deb
sudo apt update
dpkg -i zabbix-release_5.0-1+trusty_all.deb

Install Agent

sudo apt install zabbix-agent

Configure Zabbix Agent for Passive Checks

Edit the zabbix configuration file:

sudo vi /etc/zabbix/zabbix_agentd.conf

Set the following parameter according to your environment:

Server=192.168.100.51

save the file and close

Restart and enable zabbix agent service

sudo systemctl restart zabbix-agent
sudo systemctl enable zabbix-agent

Start/stop/check status of zabbix agent service:

sudo systemctl start zabbix-agent
sudo systemctl stop zabbix-agent 
sudo systemctl status zabbix-agent

Configure Zabbix Agent for Active Checks

Edit the zabbix configuration file:

sudo vi /etc/zabbix/zabbix_agentd.conf

Set the following parameters according to your environment:

ServerActive=192.168.100.51
Hostname=zabbix.fosstechnix.local

save the file and close

Restart and enable zabbix agent service

sudo systemctl restart zabbix-agent
sudo systemctl enable zabbix-agent

Start/stop/check status of zabbix agent service:

sudo systemctl start zabbix-agent
sudo systemctl stop zabbix-agent 
sudo systemctl status zabbix-agent

Configure TLS with PSK

Edit the zabbix configuration file:

sudo nano /etc/zabbix/zabbix_agentd.conf

Set the following parameters where unique_psk_identity is some unique value for the agent you are configuring. I can be anything as long as it's unique for this host:

TLSConnect=psk
TLSAccept=psk
TLSPSKIdentity=unique_psk_identity
TLSPSKFile=/etc/zabbix/zabbix_agentd.psk

save the file and close

Run the following command to generate a psk file using the path and name specified in the TLSPSKFile parameter from above:

openssl rand -hex 32 | sudo tee /etc/zabbix/zabbix_agentd.psk

Note the generated random string as you will need it to configure the agent on the Zabbix server under the Configuration --> Hosts --> Host -->Encryption tab.

Start/stop/check status of zabbix agent service:

sudo systemctl start zabbix-agent
sudo systemctl stop zabbix-agent 
sudo systemctl status zabbix-agent