The Zabbix agent configuration file controls which Zabbix servers may query the agent, where it sends active checks, how it identifies itself, and which custom checks and security rules it uses. This page explains the parameters that matter most in zabbix_agentd.conf and zabbix_agent2.conf, then adds a working minimal configuration, testing commands, PSK encryption and fixes for common agent errors.
Location of Zabbix Agent Configuration file
- Linux – Zabbix Agent Version 1 – /etc/zabbix/zabbix_agentd.conf
- Linux – Zabbix Agent Version 2 – /etc/zabbix/zabbix_agent2.conf
- Windows – Zabbix Agent Version 1 – zabbix_agent.conf
- Windows – Zabbix Agent Version 2 – zabbix_agent2.win.conf
Zabbix Agent Config Parameters Details
- Zabbix Agent (UNIX) Configuration parameters Details
- Zabbix Agent 2 (UNIX) Configuration parameters Details
- Zabbix Agent (Windows) Configuration parameters Details
- Zabbix Agent 2 (Windows) Configuration parameters Details
Example of Zabbix Agent Configuration file
Corrected file locations and how to reload changes
The Linux paths above are correct for official Zabbix packages. The Windows names need fixing. zabbix_agentd.win.conf and zabbix_agent2.win.conf are the names of the sample files in the Zabbix source tree. When you install with the MSI package, the file on disk has a different name.
| Agent | OS | Default config file (package/MSI install) | Service name |
|---|---|---|---|
| Zabbix agent | Linux | /etc/zabbix/zabbix_agentd.conf | zabbix-agent |
| Zabbix agent 2 | Linux | /etc/zabbix/zabbix_agent2.conf | zabbix-agent2 |
| Zabbix agent | Windows | C:\Program Files\Zabbix Agent\zabbix_agentd.conf | Zabbix Agent |
| Zabbix agent 2 | Windows | C:\Program Files\Zabbix Agent 2\zabbix_agent2.conf | Zabbix Agent 2 |
The agent reads its configuration only when it starts. Restart it after every change:
# Linux
sudo systemctl restart zabbix-agent # agent 1
sudo systemctl restart zabbix-agent2 # agent 2
sudo systemctl status zabbix-agent --no-pager
# Windows (PowerShell as Administrator)
Restart-Service "Zabbix Agent"
Restart-Service "Zabbix Agent 2"Code language: PHP (php)
Passive and active checks: the parameters that matter most
Most of the file above is commented-out defaults. Only a handful of lines decide whether monitoring works, and they belong to two modes:
- Passive checks: the server or proxy connects to the agent on TCP 10050 and asks for a value. This is controlled by
Server,ListenPort,ListenIPandStartAgents. - Active checks: the agent connects to the server or proxy on TCP 10051, downloads its list of items and pushes the results. This is controlled by
ServerActive,Hostname,RefreshActiveChecks,BufferSendandBufferSize.
| Parameter | What it does | Typical value |
|---|---|---|
Server | IPs, CIDRs or DNS names allowed to connect for passive checks. Connections from anywhere else are rejected. | 192.168.1.5 |
ServerActive | Server or proxy address the agent connects to for active checks. If empty, active checks are disabled. | 192.168.1.5 or zbx.example.com:10051 |
Hostname | Must match the Host name in the frontend exactly (case-sensitive). Needed for active checks and auto-registration. | web01 |
HostMetadata | Free text the server uses in auto-registration action conditions. | Linux web |
Timeout | Maximum seconds the agent spends on one check. | 3 to 10 |
Include | Loads extra .conf files, usually user parameters. | /etc/zabbix/zabbix_agentd.d/*.conf |
LogFileSize | Built-in log rotation in MB. 0 turns it off. | 0 with logrotate, otherwise 10 |
DebugLevel | Log detail from 0 to 5. Use 4 only while troubleshooting. | 3 |
Note: The example file above ships with Server=127.0.0.1, ServerActive=127.0.0.1 and Hostname=Zabbix server. Those values are only right for the agent installed on the Zabbix server itself. On every other host, change all three, or the agent will reject the server and active checks will fail.
A minimal working configuration for a monitored Linux host
You don't need to edit hundreds of lines. Keep the packaged file and make sure these lines are set and not commented out. In this example the Zabbix server is 192.168.1.5 and the host is called web01 in the frontend.
PidFile=/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.1.5
ServerActive=192.168.1.5
Hostname=web01
HostMetadata=Linux
Timeout=5
Include=/etc/zabbix/zabbix_agentd.d/*.confCode language: JavaScript (javascript)
If a proxy monitors the host, put the proxy's address in Server and ServerActive, not the server's. You can list more than one entry, separated by commas, for example Server=192.168.1.5,192.168.1.6. Packaged installs set LogFileSize=0 because logrotate handles rotation. Set it to 10 or similar if logrotate is not set up for the agent log.
Open the firewall for passive checks, then restart the agent:
# firewalld (RHEL, Rocky, Alma)
sudo firewall-cmd --permanent --add-port=10050/tcp
sudo firewall-cmd --reload
# ufw (Ubuntu)
sudo ufw allow from 192.168.1.5 to any port 10050 proto tcp
sudo systemctl restart zabbix-agentCode language: PHP (php)
Active checks only need outbound access from the agent to port 10051 on the server or proxy.
Testing the configuration
Check the agent locally first, then from the server. On recent versions, -T validates the config file without starting the agent. -t tests a single item key, and -p prints every built-in key with its current value.
# On the agent host
sudo zabbix_agentd -T -c /etc/zabbix/zabbix_agentd.conf # validate syntax
zabbix_agentd -t agent.ping
zabbix_agentd -t system.cpu.load[all,avg1]
# Expected output
agent.ping [u|1]
system.cpu.load[all,avg1] [d|0.120000]
# On the Zabbix server or proxy (package zabbix-get)
zabbix_get -s 192.168.1.20 -p 10050 -k agent.ping
1Code language: PHP (php)
If zabbix_get returns 1, passive checks work end to end. For agent 2, use zabbix_agent2 -t <key> in the same way. Then confirm active checks in the agent log with sudo tail -f /var/log/zabbix/zabbix_agentd.log.
Adding custom metrics with UserParameter
Put custom checks in their own files under the Include directory rather than editing the main file. Package upgrades then won't overwrite them, and tools such as Ansible can manage them easily.
# /etc/zabbix/zabbix_agentd.d/custom.conf
# Simple key: number of nginx processes
UserParameter=custom.nginx.procs,pgrep -c nginx
# Flexible key: count processes for any name, e.g. custom.proc.count[sshd]
UserParameter=custom.proc.count[*],pgrep -c "$1"Code language: PHP (php)
sudo systemctl restart zabbix-agent
zabbix_agentd -t custom.proc.count[sshd]
# custom.proc.count[sshd] [t|2]Code language: CSS (css)
- Commands run as the
zabbixuser, so that user must be able to run them and read any files they use. - In flexible (
[*]) keys,$1to$9are the key arguments. Write$$when you need a literal$in the command, for example in awk. - Keep
UnsafeUserParameters=0unless you really need special characters in arguments. Enabling it lets callers pass shell metacharacters into your commands. - Keep each command under the
Timeoutvalue. For slow commands, cache the result with a cron job and read the file withvfs.file.contents.
Securing the agent
Restrict remote commands. system.run[*] is denied by default. If you need it, allow only specific commands. Rules are checked in the order they appear and the first match wins, so put the specific AllowKey before the broad DenyKey. EnableRemoteCommands is deprecated, as the comment above says. Use AllowKey and DenyKey instead.
AllowKey=system.run[/usr/bin/uptime]
DenyKey=system.run[*]
LogRemoteCommands=1Code language: JavaScript (javascript)
Encrypt traffic with a pre-shared key (PSK). By default, agent traffic is plain text. Generate a key on the agent host:
openssl rand -hex 32 | sudo tee /etc/zabbix/zabbix_agentd.psk
sudo chown zabbix:zabbix /etc/zabbix/zabbix_agentd.psk
sudo chmod 600 /etc/zabbix/zabbix_agentd.psk
TLSConnect=psk
TLSAccept=psk
TLSPSKIdentity=PSK-web01
TLSPSKFile=/etc/zabbix/zabbix_agentd.pskCode language: JavaScript (javascript)
Restart the agent. Then, in the frontend, open the host, go to the Encryption tab, select PSK for connections to and from the host, and enter the same identity and key. Until both sides match, checks fail with TLS errors. To test with zabbix_get, add --tls-connect psk --tls-psk-identity PSK-web01 --tls-psk-file <file>.
Note: Leave AllowRoot=0 so the agent runs as the unprivileged zabbix user. On systemd hosts, the service unit decides the user, as the comment in the file says.
Zabbix agent vs agent 2 configuration
Agent 2 is written in Go and shares most core parameters with agent 1: Server, ServerActive, Hostname, HostMetadata, Timeout, Include, UserParameter, AllowKey/DenyKey and the TLS options. The main differences:
- Agent 2 extends itself through plugins configured with
Plugins.<Name>.*parameters, for example for PostgreSQL, MySQL, Redis or Docker. It has noLoadModule. - Agent 2 doesn't pre-fork worker processes the way
StartAgentsdoes in agent 1. - Agent 2 has a
ControlSocketfor runtime commands, and its include directory is/etc/zabbix/zabbix_agent2.d/.
When you move from agent 1 to agent 2, don't copy the old file across unchanged. Start from the packaged zabbix_agent2.conf and transfer your Server, ServerActive, Hostname, metadata, TLS settings and user parameters.
Common errors and fixes
| Symptom | Cause | Fix |
|---|---|---|
zabbix_get returns Connection refused | Agent is not running, is listening on another IP or port, or a firewall blocks 10050 | Check systemctl status, ss -tlnp | grep 10050, ListenIP and firewall rules |
Agent log shows connection from "x" rejected, allowed hosts: "127.0.0.1" | The server or proxy IP is missing from Server | Add the real source IP of the server or proxy to Server, then restart |
Log shows no active checks on server ... host [web01] not found | Hostname does not match the frontend host name | Make them identical, including case |
Item shows Timeout while executing a shell script | A UserParameter or check runs longer than Timeout | Speed up the command or raise Timeout (maximum 30) |
| Host interface shows a TLS or PSK error | PSK identity or key differs between agent and frontend, or the key file can't be read | Compare both values and check that the file is owned by zabbix |
Note: For more detail while troubleshooting, set DebugLevel=4 temporarily, or run zabbix_agentd -R log_level_increase on a running agent 1. Set it back afterwards, because level 4 fills the log quickly.
Frequently asked questions
Where is the Zabbix agent configuration file on Linux?
With official packages, agent 1 uses /etc/zabbix/zabbix_agentd.conf and agent 2 uses /etc/zabbix/zabbix_agent2.conf. Extra files are loaded from /etc/zabbix/zabbix_agentd.d/ or /etc/zabbix/zabbix_agent2.d/ through the Include parameter.
What is the difference between Server and ServerActive in zabbix_agentd.conf?
Server lists the hosts allowed to connect to the agent for passive checks on port 10050. ServerActive is the address the agent connects to on port 10051 to fetch and send active checks.
Do I need to restart the Zabbix agent after changing the configuration?
Yes. The agent reads its configuration only at startup, so restart the service after any change. On recent versions you can reload user parameters with zabbix_agentd -R userparameter_reload.
Why does my host show active checks as unavailable?
Usually Hostname in the agent config doesn't exactly match the host name in the frontend, or ServerActive points to the wrong address. It can also be a firewall blocking outbound traffic to port 10051.
How do I test a Zabbix agent from the server?
Install the zabbix-get package on the server or proxy and run zabbix_get -s <agent-ip> -k agent.ping. A result of 1 means the agent accepts passive checks from that server.
Related tutorials
- Zabbix Tutorials: Example of zabbix_agentd.conf
- Zabbix Tutorials: Example of zabbix_agent2.win.conf
- Ansible Playbook for Zabbix Agent Deployment
- More Zabbix tutorials
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services โ all in one place.
Explore Hospitals