How to Set Up Windows Server 2019 with Zabbix

Zabbix is an enterprise-class open-source monitoring platform that provides agent-based and agentless monitoring of Windows Server 2019 infrastructure. The Zabbix agent for Windows collects over 100 built-in metrics including CPU, memory, disk, network, services, and event log data. Zabbix’s template system makes it straightforward to apply consistent monitoring to all Windows Server 2019 hosts. This guide covers deploying the Zabbix agent on Windows Server 2019, configuring the Zabbix server to monitor it, and setting up triggers and alerts.

Installing the Zabbix Agent on Windows Server 2019

# Download Zabbix agent 6.4 for Windows (64-bit)
$zabbixVersion = "6.4.0"
$downloadUrl = "https://cdn.zabbix.com/zabbix/binaries/stable/6.4/$zabbixVersion/zabbix_agent2-$zabbixVersion-windows-amd64-openssl.msi"
Invoke-WebRequest -Uri $downloadUrl -OutFile "C:Tempzabbix_agent2.msi"

# Silent install with Zabbix server address and hostname
msiexec /i C:Tempzabbix_agent2.msi /quiet `
  HOSTNAME=ws2019-prod-01 `
  SERVER=192.168.1.50 `
  SERVERACTIVE=192.168.1.50 `
  LISTENPORT=10050

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

Configuring the Zabbix Agent Configuration File

The agent configuration file is at C:Program FilesZabbix Agent 2zabbix_agent2.conf. Edit it for your environment:

# Key settings in zabbix_agent2.conf

# Zabbix server IP (passive checks - server pulls data)
Server=192.168.1.50

# Active server (agent pushes data)
ServerActive=192.168.1.50

# Hostname must match the Host name configured in Zabbix web UI
Hostname=ws2019-prod-01

# Agent listen port
ListenPort=10050

# Log file location
LogFile=C:Program FilesZabbix Agent 2zabbix_agent2.log
LogFileSize=100

# Enable remote commands (set to 0 in high-security environments)
EnableRemoteCommands=0

# Refresh active checks every 120 seconds
RefreshActiveChecks=120

# Buffer size for active checks
BufferSize=100

# Custom user parameters for additional monitoring
UserParameter=custom.uptime,powershell -NoProfile -Command "(Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime | Select-Object -ExpandProperty TotalHours"
UserParameter=custom.pending_updates,powershell -NoProfile -Command "(New-Object -ComObject Microsoft.Update.Session).CreateUpdateSearcher().Search('IsInstalled=0 and IsHidden=0').Updates.Count"
# Restart the agent after configuration changes
Restart-Service -Name "Zabbix Agent 2"

# Configure Windows Firewall
New-NetFirewallRule `
  -Name "Zabbix-Agent" `
  -DisplayName "Zabbix Monitoring Agent" `
  -Direction Inbound `
  -Protocol TCP `
  -LocalPort 10050 `
  -RemoteAddress 192.168.1.50 `
  -Action Allow

Adding the Windows Server 2019 Host in Zabbix Web UI

In the Zabbix web UI (http://192.168.1.50/zabbix), navigate to Configuration > Hosts > Create Host. Fill in the following:

Host name: ws2019-prod-01
Visible name: Windows Server 2019 Production 01
Groups: Windows Servers
Agent interfaces:
  IP address: 192.168.1.200
  Port: 10050

Templates (apply these templates):
  - Windows by Zabbix agent
  - Windows CPU by Zabbix agent
  - Windows memory by Zabbix agent
  - Windows filesystems by Zabbix agent
  - Windows network interfaces by Zabbix agent
  - Windows services by Zabbix agent

After saving, navigate to Monitoring > Hosts and click Latest Data for the new host to verify data is flowing. You should see metrics appearing within 60–90 seconds.

Using the Zabbix API to Add Hosts Programmatically

$zabbixUrl = "http://192.168.1.50/zabbix/api_jsonrpc.php"

# Authenticate
$auth = Invoke-RestMethod -Uri $zabbixUrl -Method Post -ContentType "application/json-rpc" -Body (@{
    jsonrpc = "2.0"; method = "user.login"; id = 1
    params = @{ user = "Admin"; password = "zabbix_admin_password" }
} | ConvertTo-Json)
$token = $auth.result

# Get group ID for "Windows Servers"
$group = Invoke-RestMethod -Uri $zabbixUrl -Method Post -ContentType "application/json-rpc" -Body (@{
    jsonrpc = "2.0"; method = "hostgroup.get"; auth = $token; id = 2
    params = @{ filter = @{ name = @("Windows Servers") } }
} | ConvertTo-Json -Depth 5)
$groupId = $group.result[0].groupid

# Get Windows template ID
$template = Invoke-RestMethod -Uri $zabbixUrl -Method Post -ContentType "application/json-rpc" -Body (@{
    jsonrpc = "2.0"; method = "template.get"; auth = $token; id = 3
    params = @{ filter = @{ name = @("Windows by Zabbix agent") } }
} | ConvertTo-Json -Depth 5)
$templateId = $template.result[0].templateid

# Create host
$newHost = Invoke-RestMethod -Uri $zabbixUrl -Method Post -ContentType "application/json-rpc" -Body (@{
    jsonrpc = "2.0"; method = "host.create"; auth = $token; id = 4
    params = @{
        host = "ws2019-prod-02"
        interfaces = @(@{ type = 1; main = 1; useip = 1; ip = "192.168.1.201"; dns = ""; port = "10050" })
        groups = @(@{ groupid = $groupId })
        templates = @(@{ templateid = $templateId })
    }
} | ConvertTo-Json -Depth 10)
Write-Output "Created host ID: $($newHost.result.hostids[0])"

Configuring Zabbix Triggers and Alerts

Triggers define when an alert is raised. The Windows template includes pre-built triggers. To customize or add triggers via the API:

# Create a custom trigger for disk space < 15% free
$trigger = Invoke-RestMethod -Uri $zabbixUrl -Method Post -ContentType "application/json-rpc" -Body (@{
    jsonrpc = "2.0"; method = "trigger.create"; auth = $token; id = 5
    params = @{
        description = "Disk C: free space below 15%"
        expression = "last(/ws2019-prod-01/vfs.fs.size[C:,pfree])<15"
        severity = 4  # 4 = High
        priority = 4
    }
} | ConvertTo-Json -Depth 10)
Write-Output "Created trigger ID: $($trigger.result.triggerids[0])"

Configure email media type in Administration > Media types > Email and assign it to user accounts. Zabbix will send email alerts when triggers fire. Review the Zabbix dashboard daily to check for unacknowledged problems and use the Problem view to track MTTR (Mean Time to Resolve) across the Windows Server fleet.