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_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 Server, ServerActive, Hostname, ControlSocket and the plugin Include are actually set. This guide covers which parameters you must change, gives a minimal working configuration, and shows how to apply and test it, secure it with PSK and fix the most common agent errors on Windows.


How to read this configuration file

zabbix_agent2.win.conf is the template name in the Zabbix source tree. When you install with the official MSI package, the file becomes zabbix_agent2.conf in the install folder, which by default is C:\Program Files\Zabbix Agent 2\. Plugin settings go in separate files under zabbix_agent2.d\plugins.d\ next to it. The trailing Include= line pulls those files in.

Every parameter is documented in the same way: a ### Option: header, a description, whether it is mandatory, the allowed range, and a commented default such as # ListenPort=10050. A commented line has no effect. The agent uses its built-in default, so you only uncomment and edit the lines you want to change. Parameter names are case sensitive, and each line uses the format Name=value with no quotes around the value.

Note: The agent reads the file only when it starts. After every edit, restart the Zabbix Agent 2 Windows service. User parameters are the exception: they can be reloaded at runtime (see below).

Parameters you must change before first start

The sample sets Server and ServerActive to 127.0.0.1 and Hostname to Windows host. These values are placeholders. With them, only a Zabbix server running on the same machine could poll the agent, and active checks would fail unless the server happens to have a host named exactly Windows host.

ParameterPurposeTypical value
ServerIPs, CIDR ranges or DNS names allowed to connect for passive checks. All other sources are rejected.192.168.1.10 (Zabbix server or proxy)
ServerActiveWhere the agent connects to fetch and send active checks. Default port is 10051.192.168.1.10 or zbx-proxy01:10051
HostnameMust match the host name configured in the Zabbix frontend exactly, including case. Required for active checks.WIN-APP01
LogFileLog path. The built-in default c:\zabbix_agent2.log is rarely what you want.C:\Program Files\Zabbix Agent 2\zabbix_agent2.log
LogFileSizeLog size in MB before rotation (0 to 1024).10
TimeoutMaximum seconds spent processing a check (1 to 30). Raise it for slow WMI or PowerShell checks.10
ListenPortPort used for passive checks.10050 (default)

If you leave Hostname commented out, the agent uses HostnameItem, which defaults to system.hostname, the Windows computer name. This works well for fleet rollouts as long as the hosts in Zabbix are named after the computer names.

Minimal working configuration

This is a complete, valid zabbix_agent2.conf for a Windows host that one Zabbix server (or proxy) at 192.168.1.10 monitors with both passive and active checks. Anything not listed keeps its default.

LogType=file
LogFile=C:\Program Files\Zabbix Agent 2\zabbix_agent2.log
LogFileSize=10
DebugLevel=3

Server=192.168.1.10
ServerActive=192.168.1.10
Hostname=WIN-APP01

Timeout=10
HeartbeatFrequency=60

ControlSocket=\\.\pipe\agent.sock

Include=.\zabbix_agent2.d\plugins.d\*.confCode language: PHP (php)

ControlSocket is the named pipe that zabbix_agent2.exe -R uses to send runtime commands to the running service. Keep it set. The final Include line loads the bundled plugin configuration files.

Apply the configuration and verify the agent

  1. Open PowerShell as Administrator and edit C:\Program Files\Zabbix Agent 2\zabbix_agent2.conf.
  2. Check that the item collection works with your configuration: & 'C:\Program Files\Zabbix Agent 2\zabbix_agent2.exe' -c 'C:\Program Files\Zabbix Agent 2\zabbix_agent2.conf' -t agent.ping. The expected output is similar to agent.ping [s|1].
  3. Restart the service: Restart-Service 'Zabbix Agent 2'. Then confirm it is running with Get-Service 'Zabbix Agent 2'.
  4. Open the passive check port in Windows Firewall (see the command below).
  5. From the Zabbix server or proxy, run zabbix_get -s <windows-ip> -k agent.ping. It should print 1.
  6. In the Zabbix frontend, create the host with the same name as Hostname, add an Agent interface on port 10050, and link a Windows template such as *Windows by Zabbix agent* or *Windows by Zabbix agent active*. The availability icon should turn green within a few minutes.
# Allow inbound passive checks from the Zabbix server only
New-NetFirewallRule -DisplayName 'Zabbix Agent 2' -Direction Inbound `
  -Protocol TCP -LocalPort 10050 -RemoteAddress 192.168.1.10 -Action Allow

# If you installed manually from the zip archive, register the service yourself
& 'C:\zabbix\zabbix_agent2.exe' -c 'C:\zabbix\zabbix_agent2.conf' -i
& 'C:\zabbix\zabbix_agent2.exe' -c 'C:\zabbix\zabbix_agent2.conf' -sCode language: PHP (php)

Use -i to install the service, -s to start it, -x to stop it and -d to uninstall it. The path given with -c is stored in the service definition, so always use an absolute path.

Note: Active-only setups need no inbound firewall rule. The agent opens the connection to ServerActive on port 10051. If you do not use passive checks, you can set StartAgents=0 (see the FAQ).

Set the same values with a silent MSI install

When you roll out to many servers, pass the key parameters as MSI properties instead of editing the file on each host. The installer writes them into zabbix_agent2.conf.

msiexec /l*v C:\Temp\zabbix_agent2_install.log /i zabbix_agent2-<version>-windows-amd64-openssl.msi /qn `
  SERVER=192.168.1.10 SERVERACTIVE=192.168.1.10 HOSTNAME=WIN-APP01 `
  ENABLEPATH=1Code language: HTML, XML (xml)

Use the MSI file name you downloaded. Check the verbose log if the service does not appear afterwards. For larger estates, configuration management tools apply the same idea. See Ansible Playbook for Zabbix Agent Deployment.

Secure the agent with PSK and key restrictions

By default, traffic between the agent and the server is unencrypted. A pre-shared key (PSK) is the simplest way to add TLS. Generate a 256-bit key on the Windows host:

$bytes = New-Object byte[] 32
[Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
$psk = ($bytes | ForEach-Object { $_.ToString('x2') }) -join ''
Set-Content -Path 'C:\Program Files\Zabbix Agent 2\psk.key' -Value $psk -NoNewline -Encoding asciiCode language: PHP (php)
TLSConnect=psk
TLSAccept=psk
TLSPSKIdentity=PSK-WIN-APP01
TLSPSKFile=C:\Program Files\Zabbix Agent 2\psk.key

# Block remote command execution explicitly (already the default)
DenyKey=system.run[*]Code language: PHP (php)

In the frontend, open the host's Encryption tab. Select PSK for both connections to and from the host, and enter the same identity and key. Restrict the NTFS permissions on psk.key to Administrators and SYSTEM. The AllowKey and DenyKey rules are processed in order. Agent 2 denies system.run[*] by default unless you add your own system.run rule, so allow it only for the specific commands you need.

Custom Windows checks with UserParameter and Alias

Put custom checks in their own file under the include directory, for example zabbix_agent2.d\plugins.d\custom.conf (it matches *.conf), or add a separate Include line for a dedicated folder.

# Number of running Windows services
UserParameter=custom.services.running,powershell.exe -NoProfile -NonInteractive -Command "(Get-Service | Where-Object Status -eq 'Running').Count"

# Short alias for a long performance counter key
Alias=cpu.total:perf_counter_en["\Processor(_Total)\% Processor Time"]Code language: PHP (php)

Test a new key locally with zabbix_agent2.exe -c <conf> -t custom.services.running. Then load the change without restarting the service: zabbix_agent2.exe -c <conf> -R userparameter_reload. This command uses the ControlSocket pipe. PowerShell starts slowly, so increase Timeout if these items become unsupported with a timeout error.

Common errors and fixes

SymptomLikely causeFix
Agent log: connection from "x.x.x.x" rejected, allowed hosts: "127.0.0.1"Server still holds the sample valueSet Server to the server or proxy address and restart
zabbix_get times outFirewall blocks 10050, or ListenIP is bound to another interfaceAdd the firewall rule and check netstat -ano | findstr 10050
Server log: host [WIN-APP01] not foundHostname differs from the frontend host name (case sensitive)Make the two names identical
Service starts and then stops immediatelySyntax error or invalid value in the configRead the agent log, or run zabbix_agent2.exe -c <conf> -T to validate the file on versions that support it
Items show Timeout while executing errorsSlow WMI or PowerShell checkIncrease Timeout (maximum 30)
TLS handshake errors in the logPSK identity or key mismatch between the agent and the frontendRe-enter the identity and key on the host's Encryption tab

Notes on the sample file

The sample is a generated template, and a few of its comments were copied over from the Linux agent. They do not apply to Windows as written:

  • The Include description mentions /usr/local/etc. On Windows MSI installs, the include directory is zabbix_agent2.d inside the agent install folder.
  • The Alias example reads /etc/passwd, which does not exist on Windows. Use a Windows key, such as the perf_counter_en alias above.
  • The PluginSocket comment says "unix socket", but on Windows the value is a named pipe (\\.\pipe\agent.plugin.sock).
  • Server=127.0.0.1, ServerActive=127.0.0.1 and Hostname=Windows host are placeholders. They must be replaced for any real remote monitoring.

Frequently asked questions

Where is the Zabbix agent 2 config file on Windows?

With the MSI installer, it is C:\Program Files\Zabbix Agent 2\zabbix_agent2.conf by default. Plugin settings are in zabbix_agent2.d\plugins.d\ in the same folder.

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 itself connects to, on port 10051 by default, to get and send active checks.

Do I need to restart the agent after editing the config?

Yes. The file is read only when the service starts, so run Restart-Service 'Zabbix Agent 2'. User parameters can be reloaded without a restart using zabbix_agent2.exe -R userparameter_reload.

Can Zabbix agent 2 run with only active checks?

Yes. Set ServerActive and Hostname, set StartAgents=0 to disable the passive listener, and leave Server empty. No inbound firewall rule is needed then.

Why does system.run not work on agent 2?

Agent 2 denies system.run[*] by default. To allow it, add explicit AllowKey=system.run[...] rules for the commands you need. Avoid allowing every command.

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_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…

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