Ad Widget

Collapse

lld via json

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xristoskon
    Junior Member
    • Feb 2024
    • 8

    #1

    lld via json


    I have created the following json :

    HTML Code:
    {
      "data": [
        {
          "NAME": "name1"
        },
        {
          "NAME": "name2"
        },
        {
          "NAME": "name3"
        },
        {
          "NAME": "name4"
        }
      ]
    }  zz0.tk4j62yykvdzz
    and i have the following in the lld macro

    {#NAME} -> (json path) $.data.*.*


    At item prototype i have

    Name {NAME}
    key: test.greplogtime[{NAME}] # custom item


    what am i doing wrong?

  • Answer selected by xristoskon at 05-02-2024, 15:39.
    Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    Describe the macro like this and value will be without square brackets
    Code:
    {#NAME} -> (json path) $.NAME

    Comment

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

      #2
      IIRC... (those jsonpaths always screw my head up.. )
      {#NAME} -> (json path) $.data.NAME or $..NAME
      and in prototype use also {#NAME}​

      Comment

      • xristoskon
        Junior Member
        • Feb 2024
        • 8

        #3
        finally , something worked. but i have an issue with the items created

        i use item prototype name: {#NAME}

        and one item that is created (for example) has name ["name1"] , how am i supposted to strip 2 characters from left and 2 from right

        Comment

        • xristoskon
          Junior Member
          • Feb 2024
          • 8

          #4
          Originally posted by cyber
          IIRC... (those jsonpaths always screw my head up.. )
          {#NAME} -> (json path) $.data.NAME or $..NAME
          and in prototype use also {#NAME}​
          finally , something worked. but i have an issue with the items created

          i use item prototype name: {#NAME}

          and one item that is created (for example) has name ["name1"] , how am i supposted to strip 2 characters from left and 2 from right​

          Comment

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

            #5
            Describe the macro like this and value will be without square brackets
            Code:
            {#NAME} -> (json path) $.NAME

            Comment

            • xristoskon
              Junior Member
              • Feb 2024
              • 8

              #6
              Originally posted by Hamardaban
              Describe the macro like this and value will be without square brackets
              Code:
              {#NAME} -> (json path) $.NAME
              thank you it worked

              Comment

              Working...