MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Zabbix Tutorials: Example of zabbix_agentd.win.conf

zabbix_agentd.win.conf is the sample configuration file that comes with the classic Zabbix agent for Windows. The file above is the stock sample from a recent release, but its Server, ServerActive, Hostname and LogFile values are placeholders. This page explains the settings that matter, gives a minimal production-ready configuration, and shows how to install, test, secure and troubleshoot the agent on Windows.


What this file is and where it lives

The Zabbix source tree ships the Windows agent sample as conf/zabbix_agentd.win.conf. The MSI installer writes its own copy, normally named zabbix_agentd.conf, to C:\Program Files\Zabbix Agent\, and the Windows service points at that file. The file name makes no difference to the agent. What matters is the path passed to the agent with -c (or --config) when the service is registered.

The format is one Parameter=value per line. Lines that start with # are comments, so every parameter the example above leaves commented out uses its built-in default. Only four lines are active in the sample: LogFile, Server, ServerActive and Hostname. That short list is the minimum needed for passive and active checks.

Note: This file is for the classic agent (zabbix_agentd.exe). Zabbix agent 2 (zabbix_agent2.exe) uses zabbix_agent2.conf. Many parameter names are the same, but plugin settings and a few options are different, so do not copy files between the two agents without checking each line.

The parameters you actually need to change

ParameterValue in the exampleWhat to set and why
Server127.0.0.1IP addresses, CIDR ranges or DNS names of the Zabbix server or proxy that runs passive checks. The agent refuses connections from any address not on this list. 127.0.0.1 works only if the server runs on the same Windows machine.
ServerActive127.0.0.1The server or proxy address (optionally with :port, default 10051) that the agent connects to for active checks. If you leave it unset, active checks are disabled.
HostnameWindows hostMust match the host name configured in the Zabbix frontend exactly, and it is case-sensitive. Active checks fail if the two differ. If you comment it out, the value of HostnameItem is used (default system.hostname).
LogFilec:\zabbix_agentd.logPut the log next to the agent, for example C:\Program Files\Zabbix Agent\zabbix_agentd.log, rather than in the root of the system drive.
LogFileSizedefault 1Size in MB at which the log rotates. A value of 10 or more keeps enough history for troubleshooting.
Timeoutdefault 3The maximum time in seconds the agent spends processing a check. Raise it if slow WMI queries, perf counters or PowerShell UserParameters time out.
Includecommented outLoads extra .conf files so you can keep custom UserParameters separate from the main file.

A minimal working configuration

Replace the placeholder addresses and host name with your own. 192.0.2.10 stands for the Zabbix server or proxy, and WIN-APP01 must match the host name in the frontend.

# C:\Program Files\Zabbix Agent\zabbix_agentd.conf
LogType=file
LogFile=C:\Program Files\Zabbix Agent\zabbix_agentd.log
LogFileSize=10
DebugLevel=3

# Passive checks: who may poll this agent
Server=192.0.2.10
ListenPort=10050

# Active checks: where to fetch the item list and send data
ServerActive=192.0.2.10
Hostname=WIN-APP01

# Optional: auto-registration metadata
HostMetadata=windows

Timeout=10

# Keep custom checks in separate files
Include=C:\Program Files\Zabbix Agent\zabbix_agentd.d\*.confCode language: PHP (php)

HostMetadata=windows is useful when the server has an auto-registration action that matches on host metadata. With that in place, new Windows hosts can be created and linked to a Windows template automatically. If you use Include with a wildcard, the directory must exist. Create it before you restart the service.

Install, start and test the Windows service

If you installed the agent from the ZIP archive instead of the MSI, register the service yourself. Run the commands in an elevated PowerShell prompt.

cd "C:\Program Files\Zabbix Agent"

# Register the service with an explicit config path
.\zabbix_agentd.exe --config "C:\Program Files\Zabbix Agent\zabbix_agentd.conf" --install

# Start / stop / remove
.\zabbix_agentd.exe --config "C:\Program Files\Zabbix Agent\zabbix_agentd.conf" --start
.\zabbix_agentd.exe --config "C:\Program Files\Zabbix Agent\zabbix_agentd.conf" --stop
.\zabbix_agentd.exe --config "C:\Program Files\Zabbix Agent\zabbix_agentd.conf" --uninstall

# After any config change
Restart-Service "Zabbix Agent"

# Allow passive checks through Windows Firewall
New-NetFirewallRule -DisplayName "Zabbix Agent" -Direction Inbound -Protocol TCP -LocalPort 10050 -Action AllowCode language: PHP (php)

Test locally first. The -t option parses the config file and runs a single item. A syntax error in the file shows up here immediately.

.\zabbix_agentd.exe -c "C:\Program Files\Zabbix Agent\zabbix_agentd.conf" -t agent.ping
# agent.ping                                    [u|1]

.\zabbix_agentd.exe -c "C:\Program Files\Zabbix Agent\zabbix_agentd.conf" -t "perf_counter[\Processor(_Total)\% Processor Time]"Code language: CSS (css)

Next, test from the Zabbix server or proxy with zabbix_get. A result of 1 means the network path, the firewall and the Server list are all correct.

zabbix_get -s 192.0.2.50 -p 10050 -k agent.ping
1Code language: CSS (css)

Custom checks: UserParameter, PerfCounter and Alias

Put custom keys in a file under the Include directory, for example zabbix_agentd.d\custom.conf, and then restart the service. On Windows the agent runs UserParameter commands through cmd.exe, so call PowerShell explicitly.

# Average CPU interrupts/sec over the last 60 seconds
PerfCounter=interrupts,"\Processor(_Total)\Interrupts/sec",60

# Short name for a long key
Alias=pg_usage:perf_counter[\Paging File(_Total)\% Usage]

# Value returned by a PowerShell script (script must print a single value)
UserParameter=app.queue.length,powershell -NoProfile -ExecutionPolicy Bypass -File "C:\Program Files\Zabbix Agent\scripts\queue_length.ps1"Code language: PHP (php)

Run typeperf -qx to list the performance counter paths available on the host. Counter names are localised on non-English editions of Windows. Where that is a problem, the agent's perf_counter_en key accepts the English names.

Note: With the default UnsafeUserParameters=0, flexible UserParameter arguments ([*]) must not contain characters such as \, *, $ or quotes, and Windows paths contain \. Do not switch the setting to 1 just to get around this. Hard-code paths in the script instead, because unsafe parameters can open a command-injection path.

Securing the agent

  • Keep Server as narrow as possible: list exact server and proxy IPs, and never use 0.0.0.0/0 in production.
  • Leave remote commands disabled. DenyKey=system.run[*] is applied by default. If you need a specific command, allow only that exact key and put it before the deny rule, because the first matching rule wins.
  • Prefer AllowKey/DenyKey over the deprecated EnableRemoteCommands.
  • Encrypt agent traffic with a pre-shared key (PSK) or certificates. Without TLS, item values cross the network in plain text.
  • Restrict NTFS permissions on the config and PSK files to Administrators and SYSTEM.
# Allow one specific command, deny everything else
AllowKey=system.run[C:\Program Files\Zabbix Agent\scripts\restart_app.bat]
DenyKey=system.run[*]

# PSK encryption for both directions
TLSConnect=psk
TLSAccept=psk
TLSPSKIdentity=PSK-WIN-APP01
TLSPSKFile=C:\Program Files\Zabbix Agent\agent.pskCode language: PHP (php)

Generate a random 32-byte hex key in PowerShell. Then enter the same identity and key on the host's Encryption tab in the frontend.

$b = New-Object byte[] 32
[System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($b)
($b | ForEach-Object { $_.ToString('x2') }) -join '' |
  Set-Content -Encoding ascii "C:\Program Files\Zabbix Agent\agent.psk"Code language: PHP (php)

Once PSK is enforced, a plain zabbix_get call is rejected. Add the TLS options to test:

zabbix_get -s 192.0.2.50 -k agent.ping --tls-connect psk \
  --tls-psk-identity PSK-WIN-APP01 --tls-psk-file /etc/zabbix/win-app01.psk

Common errors and fixes

SymptomLikely causeFix
Agent log: failed to accept an incoming connection: connection from "x.x.x.x" rejected, allowed hosts: "127.0.0.1"The server's IP is not in ServerAdd the server or proxy IP to Server and restart the service
zabbix_get times out or reports cannot connectWindows Firewall, service stopped, or ListenIP bound to the wrong interfaceOpen TCP 10050, check Get-Service "Zabbix Agent", and review ListenIP
Agent log says the host was not found for active checksHostname differs from the frontend host name, including letter caseMake the two names identical
Service starts and stops immediatelyInvalid parameter, a missing Include directory, or an unreadable PSK fileRun zabbix_agentd.exe -c <file> -t agent.ping to see the parsing error
Item becomes unsupported with a timeoutA slow script or WMI query exceeds TimeoutRaise Timeout or optimise the script
New UserParameter key shows as unsupportedService not restarted, or the file is not matched by IncludeRestart the service and check the Include path and the .conf extension

While troubleshooting, set DebugLevel=4 temporarily and restart the service. Set it back to 3 afterwards, because level 4 fills the log quickly.

Frequently asked questions

Where is the Zabbix agent configuration file on Windows?

With the MSI installer it is usually C:\Program Files\Zabbix Agent\zabbix_agentd.conf. The file actually in use is whichever path was passed with --config when the service was installed. You can see it in the service's executable path in services.msc.

What is the difference between Server and ServerActive?

Server lists the hosts allowed to connect to the agent on port 10050 for passive checks. ServerActive is the address the agent connects out to, on port 10051 by default, to fetch and send active checks.

Do I need to restart the agent after editing zabbix_agentd.conf?

Yes. The Windows agent reads its configuration only at startup, so run Restart-Service "Zabbix Agent" after every change.

Why does my Windows host show active checks as unavailable?

Usually the Hostname value does not exactly match the host name in the Zabbix frontend (it is case-sensitive), ServerActive is not set, or outbound traffic to port 10051 is blocked.

Can I use zabbix_agentd.win.conf with Zabbix agent 2?

No. Agent 2 has its own zabbix_agent2.conf with plugin-specific settings. Core options such as Server, ServerActive and Hostname work the same way, but you should start from the agent 2 sample file.

Related tutorials

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
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.

Related Posts

Zabbix Tutorials: Example of zabbix_proxy.conf

The example above is the full, commented sample zabbix_proxy.conf shipped with Zabbix 7.0. It includes 7.0-only options such as ProxyBufferMode, ProxyMemoryBufferSize and the asynchronous agent, HTTP and…

Read More

Zabbix Tutorials: Example of zabbix_agentd.conf

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…

Read More

Zabbix Tutorials: Example of zabbix_agent2.win.conf

The example above is the stock zabbix_agent2.win.conf that ships with Zabbix agent 2 for Windows. Nearly every line is a comment that documents a default value. Only…

Read More

Step by Step Guide to Monitor PostGreSQL using Zabbix Agent

To monitor PostgreSQL with the classic Zabbix agent, you install the agent on the database host, create a read-only monitoring role, and deploy the user parameters and…

Read More

Ansible Playbook for Zabbix Agent Deployment

This page shows an Ansible playbook that installs and configures Zabbix agent 6.0 on CentOS and RHEL hosts. Below the original playbook you will find a corrected,…

Read More

What is Zabbix and use cases of Zabbix?

What is Zabbix? Zabbix is a powerful and open-source monitoring solution designed to give you comprehensive visibility into your IT infrastructure. It goes beyond basic monitoring by…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x