Ad Widget

Collapse

Continue with the next JSONPath if first fails (Preprocessing)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smarco
    Junior Member
    • Jan 2023
    • 2

    #1

    Continue with the next JSONPath if first fails (Preprocessing)

    Hey guys!

    I am using my scripts on many servers​...

    Example:
    Preprocessing contain a JSONPath like
    Code:
    $.status.value
    Recently on some nodes I have different output, but I don't want to duplicate dozens of scripts and templates.

    I'm looking for a way to pass to the next JSONPath if the first one doesn't contain those keys​.
    A "Custom on fail" -> "Set value to" -> SOURCE would be ideal​, but it seems to be not possible​.

    Is there a solution, a unique JSONPath with both, something​ with JS, or other?

    Thank you !!





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

    #2
    I think your only way would be to do some JS preprocessing first to normalize data and then continue with jsonpath...

    Comment

    • smarco
      Junior Member
      • Jan 2023
      • 2

      #3
      I preferred to ask if there are already native methods...

      Done with JS! Thank you!

      Comment

      Working...