[ZBX-19267] Windows (any version): Agent2 incorrectly handle WMI requests sometimes Created: 2021 Apr 20  Updated: 2025 May 20

Status: Confirmed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent2 plugin (G)
Affects Version/s: 5.0.10
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Anth0ny Assignee: Zabbix Development Team
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: JPEG File LicenseStatus.JPG     JPEG File LicenseStatus_z1.JPG     JPEG File LicenseStatus_z1_res_expected.JPG     JPEG File LicenseStatus_z1_res_unexpected.JPG    
Issue Links:
Sub-task
depends on ZBX-26187 Zabbix agent 2 wmi.getall does not re... Ready for QA

 Description   

Steps to reproduce:

  1. Create WMI item (type "int") : wmi.get[root\cimv2,Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like "Windows%"]
  2. Install Zabbix Agent2 on any (tested @ 2008R2-2016) Windows host
  3. Wait for data gathering or force it manually
  4. Locate it as "unsupported" because "Empty WMI search result"

Result: (debug logging level 4)

received passive check request: 'wmi.get[root\cimv2,Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like "Windows%"]' from '172.16.1.2'
[1] processing update request (1 requests)
[1] adding new request for key: 'wmi.get[root\cimv2,Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like "Windows%"]'
[1] created direct exporter task for plugin 'Wmi' itemid:0 key 'wmi.get[root\cimv2,Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like "Windows%"]'
executing direct exporter task for key 'wmi.get[root\cimv2,Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like "Windows%"]'
failed to execute direct exporter task for key 'wmi.get[root\cimv2,Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like "Windows%"]' error: 'Empty WMI search result.'
sending passive check response: ZBX_NOTSUPPORTED: 'Empty WMI search result.' to '172.16.1.2'

Expected:

Windows Agent 4.4.5 log file:

Requested [wmi.get[root\cimv2,Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like "Windows%"]]
.....
Sending back [1]



 Comments   
Comment by Anth0ny [ 2021 Apr 20 ]

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/sppwmi/softwarelicensingproduct

WQL : Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like "Windows%"

What can return with this query

0 Unlicensed
1 Licensed
2 OOBGrace
3 OOTGrace
4 NonGenuineGrace
5 Notification
6 ExtendedGrace
Comment by Anth0ny [ 2021 Apr 20 ]

At ALL Agent v. 4.* versions all looks correct.
But at Agent2 5.0.10 WMI looks not fully working.

Not tested for Windows Agent\Agent2 5.2 or Agent 5.0.10

Comment by Anth0ny [ 2021 Apr 21 ]

Direct request with WMIExplorer works fine.

But from test via Agent2 5.0.10 i always got "Empty result"

Item test

Expected result

Unexpected result

Comment by Mickael Martin [ 2022 Jun 28 ]

Hello,

Same thing for me :

2022/06/28 09:25:23.028253 plugin WindowsPerfMon: executing collector task
2022/06/28 09:25:23.479229 connection established using TLSv1.3 TLS_CHACHA20_POLY1305_SHA256
2022/06/28 09:25:23.479736 received passive check request: 'wmi.get[root\cimv2,"Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like 'Windows%'"]' from 'x.x.x.x'
2022/06/28 09:25:23.479736 [1] processing update request (1 requests)
2022/06/28 09:25:23.479736 [1] adding new request for key: 'wmi.get[root\cimv2,"Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like 'Windows%'"]'
2022/06/28 09:25:23.479736 [1] created direct exporter task for plugin 'Wmi' itemid:0 key 'wmi.get[root\cimv2,"Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like 'Windows%'"]'
2022/06/28 09:25:23.479736 executing direct exporter task for key 'wmi.get[root\cimv2,"Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like 'Windows%'"]'
2022/06/28 09:25:23.608464 failed to execute direct exporter task for key 'wmi.get[root\cimv2,"Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like 'Windows%'"]' error: 'Empty WMI search result.'

2022/06/28 09:25:23.609048 sending passive check response: ZBX_NOTSUPPORTED: 'Empty WMI search result.' to 'x.x.x.x'

So I got a fail check at https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/src/go/internal/agent/scheduler/task.go#296

wmi.get[root\cimv2,select status from Win32_DiskDrive where Name like '%PHYSICALDRIVE0%'] -> Work
wmi.get[root\cimv2,select LicenseStatus from SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like '%Windows%'] -> Empty
wmi.get[root\cimv2,select LicenseStatus from SoftwareLicensingProduct where Name like '%Windows%'] -> Empty
wmi.get[root\cimv2,select LicenseStatus from SoftwareLicensingProduct where ProductkeyID IS NOT NULL] -> Empty
.\zabbix_agent2.exe -t wmi.getall["root\cimv2,select * from SoftwareLicensingProduct"]
wmi.getall[root\cimv2,select * from SoftwareLicensingProduct][m|ZBX_NOTSUPPORTED] [Timeout occurred while gathering data.]

and Get-WmiObject -Query "Select LicenseStatus From SoftwareLicensingProduct where ProductkeyID IS NOT NULL and Name like 'Windows%'" returns data.

Maybe related to https://support.zabbix.com/browse/ZBX-18643 ?

Comment by Mickael Martin [ 2023 Apr 18 ]

Another tests :

With getall, works

wmi.getall[root\cimv2,Select LicenseStatus From SoftwareLicensingProduct where Name like "Windows%" and ProductkeyID IS NOT NULL][s|[{"LicenseStatus":1}]]

With the uint32 LicenseStatus , not works

wmi.get[root\cimv2,Select LicenseStatus From SoftwareLicensingProduct where Name like "Windows%" and ProductkeyID IS NOT NULL][m|ZBX_NOTSUPPORTED] [Empty WMI search result.]

 with string Description, works

wmi.get[root\cimv2,Select Description From SoftwareLicensingProduct where Name like "Windows%" and ProductkeyID IS NOT NULL][s|Windows(R) Operating System, VOLUME_MAK channel]

with another uint32... not works

wmi.get[root\cimv2,Select LicenseStatusReason From SoftwareLicensingProduct where Name like "Windows%" and ProductkeyID IS NOT NULL][m|ZBX_NOTSUPPORTED] [Empty WMI search result.] 

But, works with GracePeriodRemaining a another uint32..

wmi.get[root\cimv2,Select GracePeriodRemaining From SoftwareLicensingProduct where Name like "Windows%" and ProductkeyID IS NOT NULL][s|0]

All tests before with zabbix_agent2 Win64 (Zabbix) 6.2.8

With non-go version, works :

wmi.get[root\cimv2,Select LicenseStatus From SoftwareLicensingProduct where Name like "Windows%" and ProductkeyID IS NOT NULL] [u|1]
Comment by Mickael Martin [ 2023 Nov 27 ]

Hello,

Can you provide a correction for the future v7, please? We have this bug for 2 years.

Generated at Sun Jun 01 12:05:58 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.