Ad Widget

Collapse

Zabbix 4.4.3 http agent LLD discovery JSON + item prototype with LLD Macro

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • michalb
    Junior Member
    • Apr 2018
    • 20

    #1

    Zabbix 4.4.3 http agent LLD discovery JSON + item prototype with LLD Macro

    Hello all

    First sorry for my english .

    I'm working on teplate for LLD discovery JSON data from API and i have problem with creating item prototype.

    For example :

    I have LLD macro created from discovery with JSON path and value is hostname : example.host.net . When use this macro in item key prototype : hostname[{#MYMACRO}] , after discovery i have items with name like this : hostname["["example.host.net"]"] . It's possible to remove backslashes and quotes ? . When i try use this macro in item prototype http agent and place this macro in URL path , path not correct . Path is : /somewhere/["exmaple.host.net"]/anywhere .
    Any idea how to make work ?

    Many thanks for help me .

    Regards
    Michal
  • shuum
    Junior Member
    • Dec 2019
    • 11

    #2
    And I have the same problem, can someone on this forum know the solution?

    Comment

    • gert.derouck
      Member
      • Jan 2020
      • 69

      #3
      Hi, can you add the JSON file and screenshots of the discovery preprocessing and LLD macros config?

      Comment

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

        #4
        This is because you are generating the wrong json. As gert.derouck wrote - show the original json.

        Comment

        • michalb
          Junior Member
          • Apr 2018
          • 20

          #5
          Hi , my solution is using regsub on LLD macro . You can find this function on Zabbix manual page ( i'm using 4.4 ) . Syntax is :
          {{#LLDMACRO}.regsub(pattern, output)} Simply place macro to the path on item prototype with this function . I'm using regex ([\'"])(.*?) . Match group 2 and working good . Michal

          Comment

          • michalb
            Junior Member
            • Apr 2018
            • 20

            #6
            Originally posted by Hamardaban
            This is because you are generating the wrong json. As gert.derouck wrote - show the original json.
            This is not wrong JSON , this problem is on for example on API : NETBACKUP and Unify controller . :-)

            Comment


            • Hamardaban
              Hamardaban commented
              Editing a comment
              Just as you say. I saw similar behavior of LLD when I configured it. And the reason was the wrong json structure.
          • michalb
            Junior Member
            • Apr 2018
            • 20

            #7
            Hamardaban : Yes i'm understand thanks for comment , JSON data verified by JSON validator and it's OK .

            Comment

            • slarm
              Junior Member
              • Feb 2020
              • 13

              #8
              I have the same issue with Zabbix 4.4.1

              Comment

              • Mugz
                Junior Member
                • Apr 2020
                • 4

                #9
                Originally posted by michalb
                Hi , my solution is using regsub on LLD macro . You can find this function on Zabbix manual page ( i'm using 4.4 ) . Syntax is :
                {{#LLDMACRO}.regsub(pattern, output)} Simply place macro to the path on item prototype with this function . I'm using regex ([\'"])(.*?) . Match group 2 and working good . Michal
                This will not work with LLD discover and JSONPath construct

                Comment

                Working...