Ad Widget

Collapse

Problem with Item in autodiscovery

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seraph
    Junior Member
    • Feb 2022
    • 5

    #1

    Problem with Item in autodiscovery

    Hello,

    I'm using zabbix in version 5.4.4 and i have an issue with autodiscovery.
    Generated JSON file are OK and i have in it below example data:

    {"data": [{"channelID": 1, "channelSystemID": "monitor"}, {"channelID": 3, "channelSystemID": "monitor2"}, {"channelID": 24, "channelSystemID": "monitor3"}]}

    and issue appear when i try to add item.

    in script for item i'm trying to get value according to channelID what works when i run that script.
    When i set in item key channelStatus[{#channelID}]
    i receive information:
    Cannot create item: item with the same key "channelStatus[{#channelID}]" already exists.

    Please help me what am i doing wrong.

    Best Regards.
  • LenR
    Senior Member
    • Sep 2009
    • 1005

    #2
    All examples seem to have the keys in uppercase, like {#CHANNELID}, I don't know if that is a requirement or if you could fix this in preprocessing

    Comment

    • seraph
      Junior Member
      • Feb 2022
      • 5

      #3
      Hello,

      i've changed all information to uppercase, in json file and in zabbix configuration
      and i still receive this information
      Cannot create item: item with the same key "channelStatus[{#CHANNELID}]" already exists.

      Comment

      • seraph
        Junior Member
        • Feb 2022
        • 5

        #4
        i've got some new info from debuging zabbix

        30441:20220221:131121.826 In substitute_lld_macros() data:'Channel state for [{#CHANNELSYSTEMID}]'
        30441:20220221:131121.826 cannot substitute macro "{#CHANNELSYSTEMID}": not found in value set
        30441:20220221:131121.826 End of substitute_lld_macros():SUCCEED data:'Channel state for [{#CHANNELSYSTEMID}]'
        30441:20220221:131121.826 In substitute_key_macros_impl() data:'channelStatusAPI[{#CHANNELID}]'
        30441:20220221:131121.826 In substitute_lld_macros() data:'{#CHANNELID}'
        30441:20220221:131121.826 cannot substitute macro "{#CHANNELID}": not found in value set
        30441:20220221:131121.826 End of substitute_lld_macros():SUCCEED data:'{#CHANNELID}'
        30441:20220221:131121.826 End of substitute_key_macros_impl():SUCCEED data:'channelStatusAPI[{#CHANNELID}]'
        30441:20220221:131121.840 query [txnlev:0] [select key_ from items where hostid=10084 and key_='channelStatusAPI[{#CHANNELID}]']

        in json file i've got only one record:
        {"data": [{"CHANNELID": 1, "CHANNELNAME": "switch_monitoring_c", "CHANNELSYSTEMID": "monitor", "CHANNELSTATUS": "offline"}]}

        configuration Item prototypes in zabbix:
        Name: Channel state for [{#CHANNELSYSTEMID}]
        Key: channelStatusAPI[{#CHANNELID}]

        and i still receive information:
        Cannot create item: item with the same key "channelStatusAPI[{#CHANNELID}]" already exists.

        Comment

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

          #5
          I don't see you setting LLD macros anywhere... Have you pointed those {#CHANNELID} and {#CHANNELSYSTEMID} to correct json path?

          Comment

          • seraph
            Junior Member
            • Feb 2022
            • 5

            #6
            Thank You cyber for this tip
            I don't see you setting LLD macros anywhere... Have you pointed those {#CHANNELID} and {#CHANNELSYSTEMID} to correct json path?
            i've add LLD macro and all works now.

            Comment


            • lptarik
              lptarik commented
              Editing a comment
              How did you solve your issue?
              Thanks
          • seraph
            Junior Member
            • Feb 2022
            • 5

            #7
            I just add LLD macro in autodiscovery configuration
            i've put names that i have in json file according to variables used in item Key

            Comment

            Working...