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:
- Log into the Zabbix web portal
- => Data collection
- => Hosts
- => 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.
- Set Hostname => [linux-server-hostname] (exactly how the client presents its self)
- Host group => [Linux]
- Interface => add => [192.168.0.44]
- Template => [Linux]
- Description => [Added by AGIX]
- => 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.