Ad Widget

Collapse

Item Prototype from JSON

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

    #1

    Item Prototype from JSON

    Hi

    I am configuring Zabbix for use at my place of work and we have a system that returns a JSON object that we wish to monitor in Zabbix.

    I am trying to create a discovery rule that creates an item for each line of the JSON object.

    For example, the following JSON is returned.


    { "Item1": 11, "Item2": 0, "Item3": 0, "Item4": 0, "Item5": 11427}

    I need Zabbix to create an item for every item in the object and record the number associated with it. So from my example, you'd end up with five items called Item1, Item2, Item3 etc.

    Thanks in advance.
    Dan
  • NilsA
    Senior Member
    • Sep 2020
    • 102

    #2
    Hi,
    you would need to create an item prototype for each object in the JSON.
    This is pretty well documented here: https://www.zabbix.com/documentation...y/ipmi_sensors
    IPMI item or not - if you receive a JSON, you can use this as reference to build your items.

    Comment

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

      #3
      I think this section of the documentation is more appropriate https://www.zabbix.com/documentation...evel_discovery

      Comment

      • dantelemetry
        Junior Member
        • Oct 2020
        • 11

        #4
        I've read through that and I don't think it helps me. I need to grab the keys from the JSON object and use that as my LLD Macro as the items will be called the keys of the JSON object.

        I'm using
        Code:
        $.*~
        to grab the keys and it seems to be doing so but Zabbix isn't reading each on individually as I get the error
        Code:
        Cannot create item: value "Mount: ["Item1","Item2","Item3","Item4"] is too long.
        .

        If I add
        Code:
        .first()
        onto the end of the JSON path then it does work for the first 'Item1' key so it must be getting the keys correctly.

        Any help would be greatly appreciated!

        Thanks, Dan

        Comment

        • NilsA
          Senior Member
          • Sep 2020
          • 102

          #5
          You can create a normal item to collect the JSON output and make a discovery rule dependent on it. Then put in JSON paths for your macros.

          Comment

          Working...