All HowTo's Linux Ubuntu, Mint & Debian Linux

Installing & Configuring Zabbix Agent2 on Ubuntu

This article demonstrates how to install and configure the Zabbix Agent2. Our Zabbix server is already up and running, but the host (that we’re about to add) isn’t listed in Zabbix yet.

On the Zabbix server:

  1. Log into the Zabbix web portal
  2. => Data collection
  3. => Hosts
  4. => Create host

In the host frame, complete the fields using the following as a guide. Change the example entries to fit your situation. I use [ and ] to show my comments and examples. Exclude those symbols from your values.

  1. Set Hostname => [linux-server-hostname] (exactly how the client presents its self)
  2. Host group => [Linux]
  3. Interface => add => [192.168.0.44]
  4. Template => [Linux]
  5. Description => [Added by AGIX]
  6. => Add.

On the host that we want to join to Zabbix:

Run the following commands to install and start the Zabbix agent.

wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu20.04_all.deb
dpkg -i zabbix-release_6.4-1+ubuntu20.04_all.deb
apt update && apt install zabbix-agent2 zabbix-agent2-plugin-*
systemctl restart zabbix-agent2
systemctl enable zabbix-agent2
cp /etc/zabbix/zabbix_agent2.conf /etc/zabbix/zabbix_agent2.conf.orig

Edit the “/etc/zabbix/zabbix_agent2.conf” file to include only the following. Obviously you can add and remove parts. Change the IP address of your Zabbix client from “192.168.0.44” to it’s real IPv4 address.

Server=zabbix-server.example.local
ServerActive=zabbix-server.example.local
# This hosts IP address:
ListenIP=192.168.0.44
Hostname=linux-server-hostname
PidFile=/var/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log
LogFileSize=0
Include=/etc/zabbix/zabbix_agent2.d/*.conf
PluginSocket=/run/zabbix/agent.plugin.sock
ControlSocket=/run/zabbix/agent.sock
Include=/etc/zabbix/zabbix_agent2.d/plugins.d/*.conf

Now you can restart Zabbix agent and monitor the logs for issues. If there are no issues, check the Zabbix server to see if the new host is communicating.

systemctl restart zabbix-agent2
tail -f /var/log/zabbix/zabbix_agent2.log

At this point you should be done. It can take a few minutes for the Zabbix web portal to show the new host as active.

Leave a Reply

Your email address will not be published. Required fields are marked *