Introduction to Zabbix Agent 2 on Windows Server 2022

Zabbix is an enterprise-grade open-source monitoring platform that supports agentless monitoring via SNMP and IPMI as well as full agent-based monitoring. For Windows Server 2022, the recommended approach is Zabbix Agent 2, the rewritten Go-based agent that replaced the legacy C agent. Zabbix Agent 2 provides better concurrency, plugin support, and active check capabilities compared to its predecessor. This guide covers downloading, installing, configuring, and validating Zabbix Agent 2 on Windows Server 2022 with integration into the Zabbix server frontend.

Downloading Zabbix Agent 2 for Windows

Zabbix Agent 2 for Windows is distributed as an MSI installer or a ZIP archive. Download the latest stable release from the official Zabbix download page at zabbix.com/download_agents. Select the appropriate version (match your Zabbix server version), choose Windows, and select the MSI package. At the time of writing, Zabbix 7.x is the current LTS release.

Using PowerShell to download directly to the server:

$url = "https://cdn.zabbix.com/zabbix/binaries/stable/7.0/7.0.1/zabbix_agent2-7.0.1-windows-amd64-openssl.msi"
$dest = "C:downloadszabbix_agent2.msi"
Invoke-WebRequest -Uri $url -OutFile $dest

Verify the file hash against the Zabbix checksum page before installing:

Get-FileHash -Path C:downloadszabbix_agent2.msi -Algorithm SHA256

Installing Zabbix Agent 2 as a Windows Service

The MSI installer handles service registration automatically. Run the following command from an elevated PowerShell or Command Prompt. The key MSI properties are SERVER (passive check source address), SERVERACTIVE (active check destination), and HOSTNAME (how this host identifies itself to the Zabbix server):

msiexec /i C:downloadszabbix_agent2.msi `
  SERVER=192.168.1.50 `
  SERVERACTIVE=192.168.1.50 `
  HOSTNAME=WEBSRV01 `
  ENABLEPATH=1 `
  LISTENPORT=10050 `
  /qn /l*v C:logszabbix_install.log

This installs the agent to C:Program FilesZabbix Agent 2, creates the configuration file at C:Program FilesZabbix Agent 2zabbix_agent2.conf, and registers a service named Zabbix Agent 2. The /l*v flag produces a verbose installation log for troubleshooting.

Verify the service is running:

Get-Service "Zabbix Agent 2" | Select-Object Name, Status, StartType

Configuring zabbix_agent2.conf

The main configuration file is located at C:Program FilesZabbix Agent 2zabbix_agent2.conf. Open it in Notepad or PowerShell’s ISE and verify or set the following critical parameters:

# Zabbix Agent 2 Configuration
# C:Program FilesZabbix Agent 2zabbix_agent2.conf

LogFile=C:Program FilesZabbix Agent 2zabbix_agent2.log
LogFileSize=10
DebugLevel=3

# Passive checks - Zabbix server IP/CIDR allowed to query this agent
Server=192.168.1.50

# Active checks - where agent sends data proactively
ServerActive=192.168.1.50

# This host's name as it appears in Zabbix frontend
Hostname=WEBSRV01

# Listen on all interfaces
ListenIP=0.0.0.0
ListenPort=10050

# Timeout for item processing
Timeout=30

# Allow remote commands from Zabbix server (enable cautiously)
AllowKey=system.run[*]

# Number of pre-forked instances for passive checks
StartAgents=3

# Plugin socket for Zabbix Agent 2 plugins
PluginSocket=C:Program FilesZabbix Agent 2zabbix_agent2.sock

After editing the configuration file, restart the service to apply changes:

Restart-Service "Zabbix Agent 2"

Configuring Windows Firewall Rules

Zabbix uses two ports depending on the check mode. Port 10050 is used for passive checks where the Zabbix server connects inbound to the agent to retrieve data. Port 10051 is used for active checks where the agent connects outbound to the Zabbix server. Create inbound firewall rules for passive checks:

# Allow Zabbix server to query agent (passive checks)
New-NetFirewallRule `
  -DisplayName "Zabbix Agent 2 Passive" `
  -Direction Inbound `
  -Protocol TCP `
  -LocalPort 10050 `
  -RemoteAddress 192.168.1.50 `
  -Action Allow `
  -Profile Domain,Private

# Verify the rule was created
Get-NetFirewallRule -DisplayName "Zabbix Agent 2 Passive"

For active checks, the agent initiates outbound connections to port 10051 on the Zabbix server. This is typically allowed by default outbound rules but if your firewall blocks outbound traffic, add:

New-NetFirewallRule `
  -DisplayName "Zabbix Agent 2 Active" `
  -Direction Outbound `
  -Protocol TCP `
  -RemotePort 10051 `
  -RemoteAddress 192.168.1.50 `
  -Action Allow `
  -Profile Domain,Private

Adding the Windows Host in the Zabbix Frontend

Log in to the Zabbix web interface, typically available at http://zabbix-server/zabbix. Navigate to Monitoring > Hosts and click Create host. Fill in the following fields:

Host name: Must exactly match the Hostname value in zabbix_agent2.conf (WEBSRV01 in this example). Visible name: A human-friendly label such as Web Server 01. Groups: Add to an appropriate host group such as Windows Servers.

Under the Interfaces section, click Add, select Agent as the type, enter the Windows server’s IP address (192.168.1.10) and port 10050, and ensure Connect to is set to IP. Click the DNS checkbox only if you want hostname-based resolution.

Check the Monitored by proxy field if the host is behind a Zabbix Proxy. Leave it as No proxy for direct server monitoring.

Linking the Windows OS Template

Zabbix ships with pre-built templates for Windows monitoring. In the host creation form, click the Templates tab and search for Windows by OS. The recommended template for Zabbix 7.x and Windows Server 2022 is Windows by Zabbix agent or Windows by Zabbix agent active depending on whether you prefer passive or active checks. Select the template and click Add, then click the main Add button to save the host.

The template automatically applies hundreds of items, triggers, and discovery rules. Key items included in the Windows by Zabbix agent template are:

CPU utilisation (system.cpu.util[,user]), available memory (vm.memory.size[available]), total memory (vm.memory.size[total]), disk space per volume discovered automatically, system uptime (system.uptime), number of logged-in users, system name and OS version, network interface discovery with bytes/sec counters, and Windows service discovery.

Key Windows Monitoring Items and Their Keys

Beyond the template defaults, you may want to add custom items. The following Zabbix agent keys are particularly useful for Windows Server 2022:

# CPU load average over 1, 5, 15 minute windows
system.cpu.load[all,avg1]
system.cpu.load[all,avg5]
system.cpu.load[all,avg15]

# CPU utilisation percentages by type
system.cpu.util[,user]
system.cpu.util[,system]
system.cpu.util[,interrupt]
system.cpu.util[,dpc]

# Memory
vm.memory.size[available]
vm.memory.size[total]
vm.memory.size[pavailable]

# Disk space for C: volume
vfs.fs.size[C:,free]
vfs.fs.size[C:,total]
vfs.fs.size[C:,pfree]

# Service checks
service.info[wuauserv,state]
service.info[spooler,state]
service.info[W32Time,state]

# Process count
proc.num[,,,svchost.exe]

# System
system.uptime
system.hostname

Creating Windows-Specific Triggers

Triggers define the conditions under which Zabbix generates a problem event. In the Zabbix frontend, go to Configuration > Hosts, click on your Windows host, and select Triggers. Click Create trigger and configure the following examples:

High CPU trigger — fires when CPU utilisation exceeds 85% for 5 minutes:

Name: High CPU utilisation on {HOST.NAME}
Severity: Warning
Expression: avg(/WEBSRV01/system.cpu.util[,user],5m)>85

Low disk space trigger — fires when C: drive has less than 10 GB free:

Name: Low disk space on C: ({HOST.NAME})
Severity: High
Expression: last(/WEBSRV01/vfs.fs.size[C:,free])<10737418240

Service stopped trigger — fires when the Print Spooler service is not running:

Name: Spooler service is down on {HOST.NAME}
Severity: Average
Expression: last(/WEBSRV01/service.info[spooler,state])0

Configuring Zabbix Agent Auto-Registration

Auto-registration allows new agents to register themselves with the Zabbix server automatically without manual host creation. This is ideal for environments where new servers are deployed frequently. Enable it by adding the HostMetadata parameter to zabbix_agent2.conf on each Windows server:

HostMetadata=Windows Server 2022
HostMetadataItem=system.uname

On the Zabbix server, go to Configuration > Actions > Autoregistration actions and create a new action. Set the condition to Host metadata contains Windows Server 2022. Add operations to Add host, Add to host group (Windows Servers), and Link to template (Windows by Zabbix agent active).

With this configuration, any new Windows Server that starts its Zabbix agent for the first time will be automatically created in Zabbix, assigned to the correct group, and have the monitoring template applied within minutes.

Testing the Zabbix Agent from the Command Line

Zabbix Agent 2 includes a built-in test mode that executes a single item check and returns the value. This is invaluable for verifying that items work before configuring them in the Zabbix frontend. Open an elevated Command Prompt and navigate to the agent directory:

cd "C:Program FilesZabbix Agent 2"

# Test CPU load
zabbix_agent2.exe -t system.cpu.load[all,avg1]

# Test available memory
zabbix_agent2.exe -t vm.memory.size[available]

# Test service state (0=running, 1=stopped, etc.)
zabbix_agent2.exe -t service.info[spooler,state]

# Test system uptime in seconds
zabbix_agent2.exe -t system.uptime

# Test disk free space on C:
zabbix_agent2.exe -t vfs.fs.size[C:,free]

# Test hostname
zabbix_agent2.exe -t system.hostname

Each command outputs the key name followed by the collected value. A successful result looks like: system.cpu.load[all,avg1] [u|0.120000] where the letter before the pipe indicates the value type (u = unsigned integer, s = string, f = float).

To test connectivity from the Zabbix server side, use zabbix_get on Linux or the equivalent on Windows (if Zabbix utils are installed on the server):

# Run this from the Zabbix server to pull a value from the agent
zabbix_get -s 192.168.1.10 -p 10050 -k system.cpu.util[,user]

Reviewing Agent Logs and Troubleshooting

The Zabbix Agent 2 log is written to C:Program FilesZabbix Agent 2zabbix_agent2.log. Increase the DebugLevel to 4 or 5 in the configuration file temporarily to get verbose output when troubleshooting connectivity or item collection issues:

# Tail the Zabbix Agent 2 log using PowerShell
Get-Content "C:Program FilesZabbix Agent 2zabbix_agent2.log" -Wait -Tail 50

Common issues and their solutions: if the agent is not appearing in the Zabbix frontend, verify the Hostname matches exactly (case-sensitive), confirm the firewall rules are in place, and ensure the Server directive lists the correct Zabbix server IP. If items show NOTSUPPORTED in Zabbix, run the -t test command locally to see the actual error message returned by the agent. Memory and CPU items occasionally require the agent to run under the Local System account to access performance counters, which is the default service account installed by the MSI.