Ad Widget

Collapse

Stripping Characters from LLD Macros

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dantelemetry
    Junior Member
    • Oct 2020
    • 11

    #1

    Stripping Characters from LLD Macros

    Hi

    I am trying to create items using a discovery rule. The rule is a dependent rule on an HTTP Agent item that pulls the JSON from a web service.

    The JSON is formatted like this:

    Code:
    [{
    "id": "196",
    "status": "fruit",
    "description": "Apple"
    }, {
    "id": "197",
    "status": "fruit",
    "description": "Orange"
    }, {
    "id": "198",
    "status": "Vegetable",
    "description": "Cabbage"
    }]
    I have created an LLD Macro #DESCRIPTION to look at $..description. I have then setup an item prototype that should be called '{#DESCRIPTION} Status' . I would expect that to create three items, with the first one being called 'Apple Status'. However, it seems to insert characters which I can't work out how to remove, for example one of my items ends up being called '["Apple"] Status' . I need the LLD Macro to contain just the text that it receives from the JSON so that I can use pre-processing on the item prototype to integrate the status object for each using the macro to filter the JSON. I'm tempted to start writing a script to do it as this shouldn't be this difficult.

    Thanks in advance.

    Dan

  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    Try $.description (single dot)

    Comment

    • dantelemetry
      Junior Member
      • Oct 2020
      • 11

      #3
      Thats worked! Thank you so much!

      Comment

      Working...