The problem

“Help me, Obi-Wan Kenobi. My UserParameter is not supported. You’re my only hope.”

You wrote a PowerShell script that produces metrics for Zabbix. The config sits in zabbix_agentd.d\, the agent has been restarted. In Zabbix: ZBX_NOTSUPPORTED. Nothing in the agent log, no explanation.

And then, hours later, once the items finally show up: Value "1,1" not suitable for Numeric float.

Two separate problems, both specific to Windows, neither obvious.


Pitfall 1: Zabbix Agent 2 silently ignores config files with LF line endings

Symptom

ZBX_NOTSUPPORTED: Unknown metric ga4.azcopy.upload_success

You deployed the config to C:\Program Files\Zabbix Agent 2\zabbix_agentd.d\. The agent is running. Other UserParameters in the same directory work fine. Yours does not.

Diagnosis

The agent log looks unremarkable:

zabbix_agent2.log: started
zabbix_agent2.log: accepting connections

Compare against a config that does work:

# check the line endings of your own config
$bytes = [System.IO.File]::ReadAllBytes("C:\Program Files\Zabbix Agent 2\zabbix_agentd.d\my_config.conf")
# look for CR (0x0D) followed by LF (0x0A)
$hasCRLF = $false
for ($i = 0; $i -lt $bytes.Length - 1; $i++) {
    if ($bytes[$i] -eq 0x0D -and $bytes[$i+1] -eq 0x0A) { $hasCRLF = $true; break }
}
Write-Host "Has CRLF: $hasCRLF"

Result: Has CRLF: False — the config uses Unix line endings (LF) instead of Windows ones (CRLF).

Cause

Zabbix Agent 2 on Windows does not parse config files with LF line endings. There is no documented bug, no error message, and the agent starts normally. It simply never loads the file.

Why would the config have LF endings? Because it was written or edited on Linux, transferred with scp, or pulled from a Git repository without a .gitattributes.

Fix

# in PowerShell on the target host
$confPath = "C:\Program Files\Zabbix Agent 2\zabbix_agentd.d\my_config.conf"
(Get-Content $confPath) | Set-Content $confPath

Set-Content always writes CRLF. Then restart the agent:

Restart-Service "Zabbix Agent 2"

Or convert on the Linux side before deploying:

# convert before the scp
sed -i 's/\r//' config.conf       # make sure no stale CRs remain
sed -i 's/$/\r/' config.conf      # LF -> CRLF
scp config.conf user@windows-host:"C:/Program Files/Zabbix Agent 2/zabbix_agentd.d/"

Verification

# test the agent directly (as Administrator)
& "C:\Program Files\Zabbix Agent 2\zabbix_agent2.exe" -t "my.custom.key"

Expected output once fixed:

my.custom.key                                 [s|1]

Pitfall 2: non-English Windows, PowerShell and the decimal comma

Symptom

Three of four items deliver data. The fourth:

Value of type "string" is not suitable for value type "Numeric (float)". Value "1,1"

Your script emits 1,1 where Zabbix wants 1.1.

Cause

PowerShell honours the Windows system locale. On German Windows — and on French, Spanish, Italian, Dutch, Polish, Brazilian Portuguese and most of continental Europe — the decimal separator is a comma, not a period. Zabbix expects a period, always, regardless of the agent’s system language.

This hits every operation that emits a decimal number:

# German Windows — prints "1,5"
$hours = [math]::Round(1.5, 1)
Write-Output $hours   # -> "1,5"

# an explicit ToString does not necessarily help either
Write-Output $hours.ToString()   # -> "1,5"

If you build your monitoring on an English-locale machine and roll it out to a fleet with mixed locales, this shows up on some hosts and not on others — which makes it look like a script bug rather than a locale problem.

Fix

# InvariantCulture forces the period as decimal separator
$hours = [math]::Round(((Get-Date) - $logFile.LastWriteTime).TotalHours, 1)
Write-Output ($hours.ToString([System.Globalization.CultureInfo]::InvariantCulture))

Apply this to every numeric output of a Zabbix UserParameter script that returns decimal values on a non-English Windows host.


Bonus trap: two Zabbix agent services

If restarting the service changes nothing at all, check that you are restarting the right one.

Get-Service *zabbix*
Status   Name               DisplayName
------   ----               -----------
Stopped  ZabbixAgent        Zabbix Agent
Running  ZabbixAgent2       Zabbix Agent 2

Windows hosts that have been around a while sometimes carry both versions. The old “Zabbix Agent” sits there stopped, and restarts aimed at it accomplish nothing.

The active service is named "Zabbix Agent 2" (with spaces), not "ZabbixAgent2":

Restart-Service "Zabbix Agent 2"

Checklist: debugging UserParameters on Windows

When a UserParameter returns ZBX_NOTSUPPORTED:

  • Does the config file use CRLF line endings? (run it through Set-Content)
  • Did you restart the right service? (check Get-Service *zabbix*)
  • Test the agent on the host directly: zabbix_agent2.exe -t "my.key"
  • Run the script by hand: powershell -File "C:\Scripts\my_script.ps1" -Metric test

When the item delivers data but is flagged as an error:

  • Decimal values: ToString([System.Globalization.CultureInfo]::InvariantCulture)
  • Integers: [int] or [math]::Round(..., 0) are safe
  • Item type correct? Numeric (float) for decimals, Numeric (unsigned) for integers

TL;DR

  1. CRLF: Zabbix Agent 2 on Windows does not load LF configs — no error, just ignored. Fix: (Get-Content config.conf) | Set-Content config.conf
  2. Decimal separator: PowerShell on a non-English Windows emits 1,1 where Zabbix wants 1.1. Fix: .ToString([System.Globalization.CultureInfo]::InvariantCulture)
  3. Service: Get-Service *zabbix* tells you whether you are restarting the right one.