In this tutorial, you will learn how to easily install Zabbix agent on Ubuntu 22.04/Debian 11.
Install Zabbix Agent on Ubuntu 22.04/Debian 11
Zabbix agent can be used to poll various system metrics as outlined below and push them to Zabbix server for visualization.
Network | Packets/bytes transferred Errors/dropped packets Collisions |
---|---|
CPU | Load average CPU idle/usage CPU utilization data per individual process |
Memory | Free/used memory Swap/pagefile utilization |
Disk | Space free/used Read and write I/O |
Service | Process status Process memory usage Service status (ssh, ntp, ldap, smtp, ftp, http, pop, nntp, imap) Windows service status DNS resolution TCP connectivity TCP response time |
File | File size/time File exists Checksum MD5 hash RegExp search |
Log | Text log Windows eventlog |
Other | System uptime System time Users connected Performance counter (Windows) |
Install Zabbix agent on Ubuntu 22.04
- Install Zabbix DEB Repositories on Ubuntu 22.04;
wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-2+ubuntu22.04_all.deb
dpkg -i zabbix-release_6.0-2+ubuntu22.04_all.deb
- Run system package cache update and install Zabbix agent on Ubuntu 22.04
apt update
apt install zabbix-agent
Install Zabbix agent on Debian 11
- Install Zabbix DEB Repositories on Debian 11;
wget https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-1+debian11_all.deb
dpkg -i zabbix-release_6.0-1+debian11_all.deb
- Install Zabbix Agent
apt update
apt install zabbix-agent
Configure Zabbix Agent
Once the installation is done, configure Zabbix agent to be able to communicate with the Zabbix server.
vim /etc/zabbix/zabbix_agentd.conf
The only change we make here is to set Zabbix server IP address for passive and active checks, and just hostname.
...
Server=192.168.60.22 ## IP for Zabbix Server
...
ServerActive=192.168.60.22
...
Hostname=jellyfish
Save and exit the file.
Ensure the agent hostname is resolvable to an IP address that it will use to communicate with the Zabbix server and not a loopback address. Exact Hostname will be required while adding hosts to the Zabbix server for monitoring.
If no DNS in place, use host file;
ping jellyfish -c 4
PING jellyfish (192.168.60.23) 56(84) bytes of data.
64 bytes from jellyfish (192.168.60.23): icmp_seq=1 ttl=64 time=0.030 ms
64 bytes from jellyfish (192.168.60.23): icmp_seq=2 ttl=64 time=0.092 ms
64 bytes from jellyfish (192.168.60.23): icmp_seq=3 ttl=64 time=0.035 ms
64 bytes from jellyfish (192.168.60.23): icmp_seq=4 ttl=64 time=0.071 ms
--- jellyfish ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3028ms
rtt min/avg/max/mdev = 0.030/0.057/0.092/0.025 ms
Running Zabbix Service on Ubuntu 22.04/Debian 11
Start and enable Zabbix service on Ubuntu 22.04/Debian 11 to run on boot;
systemctl enable --now zabbix-agent
Check the status;
systemctl status zabbix-agent
● zabbix-agent.service - Zabbix Agent
Loaded: loaded (/lib/systemd/system/zabbix-agent.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-05-14 22:26:15 EAT; 7min ago
Main PID: 6340 (zabbix_agentd)
Tasks: 6 (limit: 1693)
Memory: 5.7M
CPU: 190ms
CGroup: /system.slice/zabbix-agent.service
├─6340 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
├─6341 /usr/sbin/zabbix_agentd: collector [idle 1 sec]
├─6342 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection]
├─6343 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection]
├─6344 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection]
└─6345 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
May 14 22:26:13 debian11 systemd[1]: Starting Zabbix Agent...
May 14 22:26:15 debian11 systemd[1]: Started Zabbix Agent.
Zabbix Agent listens on port 10050/TCP.
ss -altnp | grep 10050
LISTEN 0 4096 0.0.0.0:10050 0.0.0.0:* users:(("zabbix_agentd",pid=2412,fd=4),("zabbix_agentd",pid=2411,fd=4),("zabbix_agentd",pid=2410,fd=4),("zabbix_agentd",pid=2409,fd=4),("zabbix_agentd",pid=2408,fd=4),("zabbix_agentd",pid=2407,fd=4))
LISTEN 0 4096 [::]:10050 [::]:* users:(("zabbix_agentd",pid=2412,fd=5),("zabbix_agentd",pid=2411,fd=5),("zabbix_agentd",pid=2410,fd=5),("zabbix_agentd",pid=2409,fd=5),("zabbix_agentd",pid=2408,fd=5),("zabbix_agentd",pid=2407,fd=5))
The server should be able to connect to the agent via this port. Hence, open this port on firewall;
ufw allow from <zabbix-server-IP> to any port 10050 proto tcp comment "Allow Zabbix Server"
Also, ensure that you can connect to Zabbix server on port 10051/tcp.
Monitor the Host from Zabbix Server
You can now add the host to the Zabbix server and start monitoring.
See the link below on how to add and monitor Linux hosts using Zabbix server.
Add Hosts to Zabbix Server for Monitoring
Other Tutorials
Install Sensu Agent on Windows systems