Powershell – Zabbix Discovery JSON values

agentdiscoverypowershellzabbix

I have multiple Zabbix agents (Windows agent) and I need to check software license's details on each agent via a localhost JSON URL.

On each agent we can see license information on local web URL like this http://localhost/license/GetAllActiveLicenses
And this URL shows details in JSON format like this:

{"GetAllActiveLicenseResult":
    {"Licenses":[
        {"LicenseName":"ImageServer","Enabled":true,"Remaining":"383 Day","StringExpireDate":"27-4-2020 00:00:00"},
        {"LicenseName":"WebReview","Enabled":true,"Remaining":"383 Day","StringExpireDate":"27-4-2020 00:00:00"},
        {"LicenseName":"Portal","Enabled":true,"Remaining":"774 Day","StringExpireDate":"23-5-2021 00:00:00"}
    ]}
}

I need to create a discovery rule to read each license field.

Best Answer

This site is not geared towards writing solutions for you, but we can look at the possible approaches to solve this.

  • If you have Zabbix 4.2 or later, you can use pre-processing in LLD rules to turn this JSON into a Zabbix LLD JSON (after ensuring it is a valid JSON, see comments on the question).
  • If you have an older version, you might need a script to perform that conversion.
Related Topic