Ad Widget

Collapse

Zabbix 4.4: LLD macros and JSONPath : Cannot find the "data" array

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 20k
    Junior Member
    • Apr 2017
    • 18

    #1

    Zabbix 4.4: LLD macros and JSONPath : Cannot find the "data" array

    Hi,

    I'm getting started with the use of HTTP agent to request an API returning JSON data from which I want to extract some LLD macros.
    What I'm trying to achieve seems very basic but I'm getting an error.

    Here is my Discovery rule
    Click image for larger version

Name:	discoveryrule.jpg
Views:	4184
Size:	69.8 KB
ID:	388637
    The API returns the following JSON, containing only a "id" array

    # curl http://127.0.0.1:8088/counters/capture
    {"id":[103,101,104,102]}


    I then have the following LLD macros to extract the ids with JSONPath = $.id[:]
    Click image for larger version

Name:	lldmacro.jpg
Views:	3964
Size:	26.9 KB
ID:	388636

    Looks very simple but I'm getting the below error
    Click image for larger version

Name:	error.jpg
Views:	3775
Size:	13.1 KB
ID:	388638



    Any clue on what I'm doing wrong?


    Thanks in advance!
    20k

    Attached Files
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    What is the detailed version of Zabbix you are using? Assuming Zabbix 4.0, when using LLD, it is necessary to use the format shown in the following URL.


    If LLD processing is performed directly, the following formats are not supported.
    Code:
    {"id":[103,101,104,102]}

    Comment

    • 20k
      Junior Member
      • Apr 2017
      • 18

      #3
      Hi,
      Thanks for your reply.
      I'm using Zabbix version 4.4.0 and understood that "since Zabbix 4.2, the format of the JSON returned by low-level discovery rules has been changed. It is no longer expected that the JSON will contain the "data" object."
      Am I misunderstanding something ?

      20k

      Comment

      • 20k
        Junior Member
        • Apr 2017
        • 18

        #4
        Anyone to confirm there is no way to perform LLD whith such JSON data ?

        Comment

        • Atsushi
          Senior Member
          • Aug 2013
          • 2028

          #5
          Isn't it possible if you receive JSON in the following format?
          Code:
          [{"id":"103"},{"id":"101"},{"id":"104"},{"id":"102"}]

          Comment

          • 20k
            Junior Member
            • Apr 2017
            • 18

            #6
            My goal was actually to have many discovery rules, all depending on a same HTTP item which returns a JSON containing different type of items at different paths in the JSON.
            Then I suppose this cannot be achieved as long as the root element MUST be "data", is my understanding right?

            Comment

            Working...