Last Updated on December 30, 2024 by Thiago Crepaldi
From previous posts, we have deployed Zabbix Server on a Proxmox container. We also hardened the installation through Let’s Encrypt certificates for the web frontend and TLS encryption for the communication between Server and Agents/Proxies, after all, although encrypted Zabbix Server <-> Agent/Proxy communication with PSK or SSL certificates 🙂
In this post I will cover how to configure a Zabbix Agent on Debian/Ubuntu Linux containers running on Proxmox VE, which can be linked with Zabbix agents to collect metrics. I will limit the scope to the Agent creation and configuration and other posts will go through the process of configuring templates to monitor stuff, such as pfSense, Apache, MySQL, Postgres, Linux, FreeBSD, etc
The process is splitted in two parts. In the first we configure Zabbix Server frontend with the to-be-created agent host and next we configure the Zabbix Agent host itself so that it can connect to the Zabbix Server.
Configuring Zabbix Server through Web UI
Go to Configuration >> Hosts and click on Create Host button. When the configuration dialog open, the Host tab should be the default one. Fill in the following fields and leave the rest as-is:
- Host
- Host name: Type your hostname as returned by
hostname
command - Templates: leave empty
- Host Groups: Linux Servers or Application or whatever describes your Agent
- Interfaces:
- Add a new interface
- Type: Agent
- IP Address: Type the server IP or leave empty
- DNS Name: Type the server FQDN or leave it empty
- Connect to: Select IP or DNS
- Port: 10050
- Description: Do your thing here
- Monitored by Proxy: (no proxy)
- Depending on you what you are going to monitor, you may also add a SNMP interface
- Add a new interface
- Host name: Type your hostname as returned by
- Encryption
- You can follow a previous post on how to use PSK or Let’s Encrypt Certificates, but in this post I will assume PSK
- Connection to host: PSK
- Connection from host: PSK
- PSK Identity: myMachinePSK
- PSK: f2ed8d2c19ab0f8af75f0285277f04f437aa6e34aafe50a9d5dc05e36364892e
Finish the host creation by clicking Update.
Configuring Zabbix Agent machine/VM/container
At this point, Zabbix server is trying to reach out to your Zabbix agent, but the Zabbix Agent is not even installed. Go to zabbix.com/download to get specifics for your Operating system, such as Debian, Ubuntu, SUSE, Rocky, etc The steps below are meant for Debian 11 (Bullseye) running Zabbix Agent 6.2:
Install Zabbix repository:
# wget https://repo.zabbix.com/zabbix/6.2/debian/pool/main/z/zabbix-release/zabbix-release_6.2-4%2Bdebian11_all.deb
# dpkg -i zabbix-release_6.2-4+debian11_all.deb
# apt update
Install Zabbix Agent 2:
# apt install zabbix-agent2 zabbix-agent2-plugin-*
Start Zabbix agent 2 process and make it start at system boot.
# systemctl restart zabbix-agent2
# systemctl enable zabbix-agent2
Now the agent software is up and running and the Zabbix server knows about its existence, but the agent doesn’t know anything about the server. Let’s edit the Zabbix Agent configuration file and point it to the Zabbix server:
# vim /etc/zabbix/zabbix_agent2.conf
Server=Type your Zabbix server IP or FQDN
ServerActive=Type your Zabbix server IP or FQDN
ListenPort=10050
Hostname=Agent hostname as returned by hostname command
By default, the server and agent communicate without encrypting data. Although this is acceptable in a LAN, I like to encrypt things just in case. You can select between my previous posts on using PSK or Let’s Encrypt Certificates to add specific encryption settings to /etc/zabbix/zabbix_agent2.conf.
Restart Zabbix agent for the settings to take effect
# systemctl restart zabbix-agent2
We are done and it is time to test the settings. Go to Configuration >> Hosts. In a couple minutes the agent you have create should be available. Look for the Availability and Agent encryption columns. When it is online, thy will be displayed in green colors. Now you are ready to start linking templates to your agent and monitor metrics
That is it, have fun!
Thank you! Very well written instructions that likely saved me hours of time