Igor Matsko
Igor Matsko

Reputation: 59

Zabbix discovery: read JSON value

I have discovery rule, which returns JSON document:

{
   "data":[
      {"SIZE":9556},
      {"SIZE_DIFFERENCE":0.00502302218501465},
      {"DUPLICATES":0},
      {"TODAY_ZERO_CLPRICE":9556},
      {"LISTED_SYMBOLS":true}
    ]
}

Can I assign values of this JSON objects to Item prototypes? Or handle it in triggers. Like "If SIZE < 1 Warning will appear"

Thank you

Upvotes: 0

Views: 10755

Answers (1)

asaveljevs
asaveljevs

Reputation: 2250

The JSON document in the question is not very valid for low-level discovery.

In that JSON, the data element has five objects, each with distinct attributes. Something like that would be more appropriate (note the LLD macro syntax):

{
   "data":[
      {
          "{#SIZE}":9556,
          "{#SIZE_DIFFERENCE}":0.00502302218501465,
          "{#DUPLICATES}":0,
          "{#TODAY_ZERO_CLPRICE}":9556,
          "{#LISTED_SYMBOLS}":true
      }
   ]
}

If you wish to create items with fixed values, you could probably create calculated items with a constant expression, like so:

{#SIZE}

However, a better approach would be to create trapper items during LLD and send those values separately.

Please see official documentation on low-level discovery and trapper items for more information.

Upvotes: 2

Related Questions