zabbix_agentd.conf is the configuration file for the classic Zabbix agent on Linux and Unix. It sets which Zabbix servers may poll the agent, where it sends active checks, what hostname it reports, and how it logs, encrypts traffic and runs custom checks. The example above is the default file that ships with Zabbix. This page explains the lines that matter, gives a production-ready version for a monitored host, and shows how to test it and fix common errors.
Where the file lives and how to read it
The example above is the stock file from a source build, so its paths point to /usr/local/etc and /tmp. Package installs from the official Zabbix repositories use different locations. Check which layout your hosts use before you copy any path.
| Item | Source build (example above) | Official packages (deb/rpm) |
|---|---|---|
| Main config | /usr/local/etc/zabbix_agentd.conf | /etc/zabbix/zabbix_agentd.conf |
| Drop-in directory | /usr/local/etc/zabbix_agentd.conf.d/ | /etc/zabbix/zabbix_agentd.d/ |
| Log file | /tmp/zabbix_agentd.log | /var/log/zabbix/zabbix_agentd.log |
| PID file | /tmp/zabbix_agentd.pid | /run/zabbix/zabbix_agentd.pid |
| Service name | started manually or with your own unit | zabbix-agent |
Each option in the file follows the same pattern: a description, whether it is mandatory, the allowed range, and the default as a commented line such as # ListenPort=10050. A commented line means the default applies. To change a setting, add an uncommented Option=value line. Lines starting with # are ignored.
Note: Zabbix agent 2 (the Go-based agent) reads a different file, zabbix_agent2.conf. Most core options have the same names, but plugin settings and some advanced options are different. Do not mix the two files.
The four active settings in the example
Only four lines in the default file are uncommented. Together they set the agent up to monitor the Zabbix server machine itself:
| Line | What it does | Change it to |
|---|---|---|
LogFile=/tmp/zabbix_agentd.log | Writes the agent log to /tmp | A persistent path such as /var/log/zabbix/zabbix_agentd.log |
Server=127.0.0.1 | Accepts passive-check connections from localhost only | The IPs, CIDR ranges or DNS names of your Zabbix server and proxies |
ServerActive=127.0.0.1 | Fetches active checks from, and sends data to, localhost on port 10051 | The server or proxy address, optionally with :port |
Hostname=Zabbix server | Name the agent reports for active checks | The exact, case-sensitive host name configured in the Zabbix frontend |
If you copy this file to a remote host without changing these lines, passive checks are rejected and active checks fail. Many hosts can also end up reporting as the same host, Zabbix server.
Production example for a monitored Linux host
In practice, leave the packaged file mostly untouched and put your settings in a drop-in file. Package upgrades then do not overwrite your changes, and configuration management tools only need to manage one small file. The packaged main file already contains Include=/etc/zabbix/zabbix_agentd.d/*.conf. The main file keeps its own Server, ServerActive and Hostname lines, so comment those out to avoid duplicate settings.
# /etc/zabbix/zabbix_agentd.d/10-site.conf
# Passive checks: only these hosts may connect to port 10050
Server=10.0.0.5,10.0.0.6
# Active checks: where to fetch the check list and send results
ServerActive=10.0.0.5:10051
# Leave Hostname unset to use the OS hostname via HostnameItem=system.hostname,
# or set it explicitly. It must match the host name in the frontend.
Hostname=web01.example.com
# Used by auto-registration actions to pick templates and host groups
HostMetadata=linux web
# Logging
LogType=file
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=10
DebugLevel=3
# Give slow items (custom scripts, disk checks) more time
Timeout=10
# Remote commands stay disabled (this is also the default)
DenyKey=system.run[*]Code language: PHP (php)
- In
/etc/zabbix/zabbix_agentd.conf, comment out the defaultServer=,ServerActive=andHostname=lines. - Create the drop-in file above with your own addresses and host name.
- Check the configuration:
sudo zabbix_agentd -T -c /etc/zabbix/zabbix_agentd.conf(recent agent versions support-T/--test-config). - Restart the agent:
sudo systemctl restart zabbix-agentandsudo systemctl enable zabbix-agent. - Open TCP 10050 inbound from the server or proxy if you use passive checks. Active checks only need outbound TCP 10051 from the agent.
To roll this out across many servers, template the drop-in file. The Ansible playbook for Zabbix agent deployment shows one way to do it.
Passive and active checks
The file splits its options into passive and active sections because the two modes work in opposite directions. A host can use both at the same time.
| Passive checks | Active checks | |
|---|---|---|
| Who connects | Server/proxy connects to the agent | Agent connects to the server/proxy |
| Port | 10050 on the agent (ListenPort) | 10051 on the server/proxy |
| Key options | Server, ListenIP, ListenPort, StartAgents | ServerActive, Hostname, RefreshActiveChecks, BufferSize |
| Item type in frontend | Zabbix agent | Zabbix agent (active) |
| Good for | Simple LAN setups | Hosts behind NAT or firewalls, log monitoring, large installations |
Note: Setting StartAgents=0 disables passive checks completely, so the agent stops listening on any port. Server is then no longer mandatory. This is a common hardening step for active-only hosts.
Testing the agent configuration
Test locally on the agent first, then from the server. Local tests check the item keys. Server-side tests check network access and the Server allow-list.
# On the agent: evaluate one key locally
zabbix_agentd -t agent.ping
# agent.ping [u|1]
zabbix_agentd -t system.hostname
# List all supported keys with their current values
zabbix_agentd -p | less
# Confirm the agent is listening
sudo ss -tlnp | grep 10050
# On the Zabbix server or proxy (zabbix-get package)
zabbix_get -s 10.0.0.21 -k agent.ping
# 1
zabbix_get -s 10.0.0.21 -k system.unameCode language: PHP (php)
If zabbix_get returns 1, passive checks work. For active checks, check the agent log after a restart. Messages about failing to retrieve the active check list point to a wrong ServerActive, a blocked port 10051 or a Hostname mismatch.
Custom checks with UserParameter
UserParameter adds your own item keys that run a shell command and return its output. Keep them in a separate file in the include directory.
# /etc/zabbix/zabbix_agentd.d/20-userparams.conf
# Fixed key: number of logged-in users
UserParameter=custom.users.count,who | wc -l
# Flexible key: [*] passes item arguments to the command as $1, $2 ...
# Usage in frontend: custom.proc.count[nginx]
UserParameter=custom.proc.count[*],ps -C "$1" --no-headers | wc -lCode language: PHP (php)
sudo systemctl restart zabbix-agent
zabbix_agentd -t custom.users.count
zabbix_agentd -t 'custom.proc.count[nginx]'Code language: JavaScript (javascript)
- Commands run as the
zabbixuser, so that user needs permission for whatever the command reads. - Commands must finish within
Timeoutseconds, or the item becomes unsupported. - Keep
UnsafeUserParameters=0unless you really need special characters in arguments. It blocks shell metacharacters that could otherwise be used for command injection. - Use
AllowKey/DenyKeyto restrict keys. Rules are evaluated in order, so put the specificAllowKeylines before a broadDenyKey.
For a full worked example of custom agent checks, see monitoring PostgreSQL with Zabbix agent.
Encrypting agent traffic with PSK
By default, agent traffic is unencrypted (TLSConnect=unencrypted, TLSAccept=unencrypted). A pre-shared key (PSK) is the simplest way to turn on TLS.
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
# /etc/zabbix/zabbix_agentd.d/30-tls.conf
TLSConnect=psk
TLSAccept=psk
TLSPSKIdentity=PSK-web01
TLSPSKFile=/etc/zabbix/zabbix_agentd.pskCode language: PHP (php)
Restart the agent. Then open the host's Encryption tab in the frontend, select PSK for connections to and from the host, and enter the same identity and key. If the two sides do not match, the host shows as unavailable.
Common errors and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
Agent log: connection from "x.x.x.x" rejected, allowed hosts: "127.0.0.1" | Server still set to the default | Add the server/proxy IP to Server and restart |
| Agent log says the host was not found when it requests active checks | Hostname does not match the frontend host name | Make both names identical, including case |
zabbix_get returns No route to host or times out | Firewall blocking 10050, or agent not running | Open the port and check systemctl status zabbix-agent |
| Item becomes unsupported with a timeout | Command is slower than Timeout | Speed up the script or raise Timeout |
| Agent will not start after an edit | Syntax error or duplicate parameter | Run zabbix_agentd -T and read the log |
system.run items fail | Remote commands denied by default | Add a narrow AllowKey=system.run[...] rule before any deny rule |
When the cause is unclear, temporarily set DebugLevel=4, restart, reproduce the problem and read the log. Set it back to 3 afterwards, because level 4 writes a lot of output.
Frequently asked questions
Where is zabbix_agentd.conf located?
On systems installed from the official Zabbix packages, it is at /etc/zabbix/zabbix_agentd.conf. Source builds use /usr/local/etc/zabbix_agentd.conf unless a different prefix was chosen at compile time.
What is the difference between Server and ServerActive?
Server lists the hosts allowed to connect to the agent for passive checks on port 10050. ServerActive is the server or proxy that the agent connects to for active checks, on port 10051 by default.
Does Hostname in zabbix_agentd.conf have to match the frontend?
Yes, for active checks. The value is case-sensitive and must exactly match the host name configured in the Zabbix frontend, or the server will not send the agent its active check list.
Do I need to restart the agent after changing zabbix_agentd.conf?
Yes. The agent reads its configuration only at startup, so run systemctl restart zabbix-agent after any change, including changes to included files and UserParameters.
Can zabbix_agent2 use zabbix_agentd.conf?
No. Agent 2 reads zabbix_agent2.conf. Many core options have the same names, but plugin settings are specific to agent 2, so write that file separately.
Related tutorials
- Ansible Playbook for Zabbix Agent Deployment
- Step by Step Guide to Monitor PostGreSQL using Zabbix Agent
- Zabbix Tutorials: Install and Configure Zabbix Proxy on Ubuntu 20.x
- Top 50 Zabbix interview questions and answers
- 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