priechodsky / Microsoft-DHCP-Server-2012-2016-2019

GNU General Public License v3.0
3 stars 1 forks source link

Cannot find the "data" array in the received JSON object. #1

Open MaartenMol opened 3 years ago

MaartenMol commented 3 years ago

With straight import the discovery gives an error: Cannot find the "data" array in the received JSON object.

Scripts runs great on the Windows machine as manually tested.

When testing "DHCP Scopes" from the Zabbix config screen it does get the JSON data.

Nothing else works...

MaxVonk commented 3 years ago

Are seeing the same problem, scopes are getting fetched without any problem but free/used and so on are not populated.

priechodsky commented 3 years ago

Hi, what version of win server are you using? Can you please send me an output from the powershell? Best directly through hosts in zabbix and the option "test". Send it to me on priechodsky.dusan@gmail.com

BernhardLinz commented 3 years ago

same here with Zabbix 5.0,8 Powershell 5.1.17763.1490

C:\Program Files\Zabbix>zabbix_agentd.exe -c zabbix_agentd.win.conf -t DHCPv4LLD

DHCPv4LLD [t|{"CimClass":{"CimSuperClassName":null,"CimSuperClass":null,"CimClassProperties":"ActivatePolicies Delay Description EndRange LeaseDuration MaxBootpClients Name NapEnable NapProfile ScopeId StartRange State SubnetMask SuperscopeName Type","CimClassQualifiers":"ClassVersion = \"1.0.0\" dynamic = True locale = 1033 provider = \"DhcpServerPSProvider\"","CimClassMethods":"","CimSystemProperties":"Microsoft.Management.Infrastructure.CimSystemProperties"},"CimInstanceProperties":["ActivatePolicies = True","Delay = 0","Description = \"Meisenweg 17\"","EndRange = \"192.168.1.254\"","LeaseDuration = 12:00:00","MaxBootpClients = 4294967295","Name = \"192.168.1.x\"","NapEnable = False","NapProfile = \"\"","ScopeId = \"192.168.1.0\"","StartRange = \"192.168.1.1\"","State = \"Active\"","SubnetMask = \"255.255.255.0\"","SuperscopeName = \"\"","Type = \"Dhcp\""],"CimSystemProperties":{"Namespace":"root/Microsoft/Windows/DHCP","ServerName":"DC","ClassName":"DhcpServerv4Scope","Path":null},"ScopeId":{"Address":108736,"AddressFamily":2,"ScopeId":null,"IsIPv6Multicast":false,"IsIPv6LinkLocal":false,"IsIPv6SiteLocal":false,"IsIPv6Teredo":false,"IsIPv4MappedToIPv6":false,"IPAddressToString":"192.168.1.0"},"SubnetMask":{"Address":16777215,"AddressFamily":2,"ScopeId":null,"IsIPv6Multicast":false,"IsIPv6LinkLocal":false,"IsIPv6SiteLocal":false,"IsIPv6Teredo":false,"IsIPv4MappedToIPv6":false,"IPAddressToString":"255.255.255.0"},"StartRange":{"Address":16885952,"AddressFamily":2,"ScopeId":null,"IsIPv6Multicast":false,"IsIPv6LinkLocal":false,"IsIPv6SiteLocal":false,"IsIPv6Teredo":false,"IsIPv4MappedToIPv6":false,"IPAddressToString":"192.168.1.1"},"EndRange":{"Address":4261521600,"AddressFamily":2,"ScopeId":null,"IsIPv6Multicast":false,"IsIPv6LinkLocal":false,"IsIPv6SiteLocal":false,"IsIPv6Teredo":false,"IsIPv4MappedToIPv6":false,"IPAddressToString":"192.168.1.254"},"ActivatePolicies":true,"Delay":0,"Description":"Meisenweg 17","LeaseDuration":{"Ticks":432000000000,"Days":0,"Hours":12,"Milliseconds":0,"Minutes":0,"Seconds":0,"TotalDays":0.5,"TotalHours":12,"TotalMilliseconds":43200000,"TotalMinutes":720,"TotalSeconds":43200},"MaxBootpClients":4294967295,"Name":"192.168.1.x","NapEnable":false,"NapProfile":"","State":"Active","SuperscopeName":"","Type":"Dhcp","PSComputerName":null}]

With Zabbix Server 5.2 and Zabbix Agent 5.0.8 i got the same error With Zabbix Server 5.2 and Zabbix Agent 5.2.4 i got the same error

The JSON is valid, the LLD Macro Paths are vaild

zfrank2601 commented 3 years ago

Today I´ve installed this plugin in Windows Datacenter 2022. The solution is a [ on the begin of json and a ] in the end of the json.

Quick and Dirty fix for this problem:

The same with Discovery-Rules --> DHCP Super Scopes

Working with my changes on Zabbix 5.4 with xml from here: https://share.zabbix.com/operating-systems/microsoft-dhcp-server-2012-2019-for-5-4

slawekjg commented 2 years ago

Hi, I have used original scripts, however modified them a little, as I am using Agent v2. As for @BernhardLinz I can do a similar test on local machine. I have added also preprocessing as @zfrank2601 is suggesting, so it looks like: image

and then doing a test on the server gives output like: image Seems preprocessing didn't work at all. Do you have any idea what can be wrong? I am using Zabbix 5.4, testing with DHCP on Windows 2019 Standard.