Ad Widget

Collapse

LLD rule creating macro with [" "] enclosings

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fsitler
    Junior Member
    • Aug 2022
    • 2

    #1

    LLD rule creating macro with [" "] enclosings

    Hello,

    I have a problem, which, I am quite sure, will be just some small thing forgotten on my side.

    I have a script which is returning a json in this format:
    { "data": [{"GRPNAME": "groupmane1"},{"GRPNAME": "groupmane2"},{"GRPNAME": "groupmane3"}]}

    I have a template with Discovery, where Key is a userparameter (custom.discovery), which is just calling the scipt returning the above data.
    UserParameter=custom.discovery[*], sh /etc/zabbix/zabbix_agent2.d/discover_groups.sh

    As a LLD Macro I have: {#GRPNAME} and JSONpath $..GRPNAME.
    Then I am usng the Macro in Item prototype, but the names of groups are generated as ["groupname1"] etc.
    I can not find a good way, how to get rid of opening and closig backets and quotations, so the Macro value will be just "groupname1", "groupname2" ... without quotes, so the items created from prototypes will have the value without the brackets.

    Does anybody have an idea, what I am doing wrong?

    Zabbix 6.0.12, but I have not seen any LLD Rule related fixes in newer LTS version
    Last edited by fsitler; 23-12-2023, 18:13.
  • Answer selected by fsitler at 02-01-2024, 00:27.
    Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    Code:
    $.GRPNAME
    ?

    Comment

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

      #2
      Code:
      $.GRPNAME
      ?

      Comment

      Working...