How to Install Zabbix Agent on Windows Server 2012 R2 for Monitoring
Zabbix is a widely deployed open-source monitoring platform that provides comprehensive monitoring for servers, applications, databases, and network devices. The Zabbix agent installed on Windows Server 2012 R2 collects system metrics, monitors services, checks log files for patterns, and executes custom checks, all reporting back to a central Zabbix Server or Zabbix Proxy. This guide covers the full installation and configuration of the Zabbix agent on Windows Server 2012 R2, including active and passive check configuration, custom item creation, and integration with Windows Event Log monitoring.
Prerequisites
A Zabbix Server (version 4.x or 5.x recommended for compatibility with Windows Server 2012 R2) must be deployed and reachable. The Zabbix Server hostname or IP address must be known. Firewall rules must permit TCP port 10050 (passive agent checks, server to agent) and TCP port 10051 (active checks, agent to server). Administrator rights on the Windows Server 2012 R2 machine are required. Download the Zabbix Windows agent installer from the official Zabbix download page (https://www.zabbix.com/download_agents) — select the version matching your Zabbix Server version.
Step 1: Download and Install the Zabbix Agent
Download the Zabbix Agent MSI installer appropriate for your server architecture (64-bit for Windows Server 2012 R2). Transfer the installer to the target server. For a silent installation specifying the Zabbix Server address:
msiexec /i zabbix_agent-5.4.0-windows-amd64-openssl.msi /qn ^
SERVER=192.168.1.100 ^
SERVERACTIVE=192.168.1.100 ^
HOSTNAME=WS2012R2-SERVER01 ^
ENABLEPATH=1
For a manual GUI installation, run the MSI, accept the license, and on the configuration page enter:
Zabbix server IP: the IP or hostname of your Zabbix Server. Server for active checks: same address. Host name: the exact hostname as it will appear in Zabbix. The hostname must match exactly what you configure in the Zabbix web interface.
The agent is installed by default to C:Program FilesZabbix Agent and the configuration file is at C:Program FilesZabbix Agentzabbix_agentd.conf.
Step 2: Configure the Zabbix Agent
Edit the agent configuration file to fine-tune behaviour. Open the configuration file in a text editor:
notepad "C:Program FilesZabbix Agentzabbix_agentd.conf"
Key configuration parameters to review and set:
### Zabbix Agent Configuration
LogFile=C:Program FilesZabbix Agentzabbix_agentd.log
LogFileSize=5
# Passive checks - allow connections from Zabbix Server
Server=192.168.1.100
# Active checks - where agent sends data
ServerActive=192.168.1.100
# This server's hostname as configured in Zabbix web interface
Hostname=WS2012R2-SERVER01
# Allow agent to be configured remotely from server
EnableRemoteCommands=0
# Timeout for processing checks (seconds)
Timeout=30
# Buffer configuration for active checks
BufferSend=5
BufferSize=100
# Log level: 0=empty, 1=critical, 2=error, 3=warning, 4=debug
DebugLevel=3
Step 3: Configure Windows Firewall for Zabbix
Allow the Zabbix agent port through Windows Firewall for passive checks (server polls the agent):
netsh advfirewall firewall add rule name="Zabbix Agent" dir=in action=allow protocol=TCP localport=10050 remoteip=192.168.1.100
Using PowerShell:
New-NetFirewallRule -DisplayName "Zabbix Agent Passive" -Direction Inbound -Protocol TCP -LocalPort 10050 -RemoteAddress 192.168.1.100 -Action Allow -Profile Domain,Private
For active checks (agent initiates connections to the server), ensure outbound connections to the server on port 10051 are permitted. Since Windows Firewall allows all outbound by default, this may not require a rule.
Step 4: Start and Verify the Zabbix Agent Service
The Zabbix agent installs as a Windows service. Start and configure it for automatic startup:
net start "Zabbix Agent"
sc config "Zabbix Agent" start= auto
Verify the service is running:
Get-Service -Name "Zabbix Agent" | Select-Object Name, Status, StartType
Test connectivity from the Zabbix Server using the zabbix_get utility (run on the Zabbix Server):
zabbix_get -s 192.168.1.200 -p 10050 -k system.cpu.load[all,avg1]
If the agent responds with a numeric value, passive connectivity is working correctly.
Step 5: Add the Host in the Zabbix Web Interface
Log into the Zabbix web interface. Navigate to Configuration → Hosts and click Create host. Enter the host name (must exactly match the Hostname in zabbix_agentd.conf). Add the server to a host group (e.g., Windows Servers). Under Interfaces, add a Zabbix Agent interface with the server’s IP address and port 10050.
Link a template to enable built-in Windows monitoring. Navigate to the Templates tab and link the template “Template OS Windows by Zabbix agent” (or the equivalent template for your Zabbix version). This template includes automatic discovery and monitoring of CPU, memory, disk, network interfaces, services, and Windows performance counters.
Step 6: Configure Custom User Parameters
Extend the agent with custom checks using UserParameter in the configuration file. A UserParameter runs a command on the agent and returns the output to the Zabbix Server:
# Add to zabbix_agentd.conf
# Check if a specific Windows service is running (returns 1=running, 0=stopped)
UserParameter=service.check[*],powershell -NoProfile -Command "(Get-Service -Name '$1' -ErrorAction SilentlyContinue).Status -eq 'Running' | % { if ($_) { 1 } else { 0 } }"
# Get IIS Application Pool state
UserParameter=iis.apppool.state[*],powershell -NoProfile -Command "Import-Module WebAdministration; (Get-WebConfiguration /system.applicationHost/applicationPools/add | Where-Object { $_.name -eq '$1' }).state"
# Count files in a directory
UserParameter=dir.filecount[*],powershell -NoProfile -Command "(Get-ChildItem -Path '$1' -File).Count"
After adding UserParameters, restart the Zabbix Agent service for changes to take effect:
Restart-Service "Zabbix Agent"
Step 7: Configure Windows Event Log Monitoring
Zabbix can monitor Windows Event Logs and trigger alerts based on specific event IDs or message patterns. Add event log monitoring items in the Zabbix web interface under the host configuration, or use the built-in template items. Example event log monitoring items to configure manually:
# Configuration entries in zabbix_agentd.conf are not needed for event log monitoring.
# Items are configured in Zabbix web interface with these item keys:
# Monitor System event log for errors
eventlog[System,,,"Error",,skip]
# Monitor Application event log for specific event ID 1000
eventlog[Application,,"1000",,skip]
# Monitor Security log for failed logon events (Event ID 4625)
eventlog[Security,,"4625",,skip]
Step 8: Verify Monitoring Data in Zabbix
After adding the host and linking templates, navigate to Monitoring → Latest Data in the Zabbix web interface. Select the host and verify that data is being received for all expected items (CPU, memory, disk, network). Initial data population may take 2-3 minutes after host creation.
Check the Zabbix agent log file for any communication errors:
Get-Content "C:Program FilesZabbix Agentzabbix_agentd.log" -Tail 50
Common error messages and their causes: “Cannot connect to Zabbix server” indicates a firewall or routing issue. “Check access restrictions” means the Server= parameter in the config does not match the connecting Zabbix Server IP.
Summary
The Zabbix agent on Windows Server 2012 R2 provides comprehensive, extensible monitoring through a lightweight service that integrates seamlessly with the Zabbix platform. By combining built-in OS templates with custom UserParameters and Windows Event Log monitoring, Zabbix delivers deep visibility into server health and application performance. The active check mode reduces dependency on inbound firewall ports, making it suitable for DMZ and restricted-network deployments. Regular updates to the agent version and Zabbix templates ensure monitoring remains effective as your environment grows.