Ad Widget

Collapse

Discovery rule with HTTP Agent and converted JSON gives errors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mariusl
    Junior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Aug 2024
    • 25

    #1

    Discovery rule with HTTP Agent and converted JSON gives errors

    Following up on my post in another thread, i'm having issues with properly handling converted JSON data from HTTP agent in a discovery rule.
    I am doing a simple request to an URL that returns a value in clear text, as example
    Code:
    mydata=0
    I'm using the function in HTTP agent to convert this to JSON which returns
    Code:
    {"body":"mydata=0"}
    Notice how it does not add an array.

    Using this, i'm getting multiple errors. Without defining any LLD Macros i get
    Cannot find the "data" array in the received JSON object.
    .
    Adding a macro with JSONPath $.body or $..body gives the same error.
    Using JSONPath $.. gives
    Cannot process LLD macro "{#UNIT_ID}": jsonpath was unexpectedly terminated.
    I have also tried JSONPath $.* and $..*, both giving errors.
    There are no preprocessing steps added.

    I'm starting to think that the "Convert to JSON" should have wrapped the data in an array. Perhaps there is a bug?
    Anyone else have some suggestions to what i could try, or can point out what i may be doing wrong?

    Thank you!
    Last edited by mariusl; 07-02-2025, 13:31. Reason: Formatting
Working...