Ad Widget

Collapse

complex json queries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bitbucket
    Junior Member
    • Sep 2020
    • 18

    #1

    complex json queries

    I'm trying to avoid using an external check check but I'm not seeing how http agent / jsonpath would would work in my case.

    The json that I'm handling looks something like the following. The size of the list is indefinite.
    [{'id":1,"status":true}{"id":2,"status":false}{"id" :3,"status"}]

    I need to iterate over the list and, if status=false, raise an alert. This means I need to handle the id/status tuple. Looking through the http agent docs, it seems more geared for querying objects in fixed locations. Have I got this wrong?
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    If you are not interested in the history of individual values, but only in the signal that at least one of the json elements has the status false, then create one item with preprocessing of the JS type and process the incoming json using javascript so that the resulting value is the result of a logical AND. Thus, if at least one of the json elements has the value false, the resulting value would also have the value false (0). Next, make a trigger.

    Comment

    • cyber
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2006
      • 4807

      #3
      Shouldn't jsonpath preprocessing be able to give you, for example, number of elements, where status = false? I am always struggling with all that json parsing, so I am not even trying to give an example..
      https://www.zabbix.com/documentation..._functionality

      Comment

      Working...