Ad Widget

Collapse

SNMP discovery - Cannot create item: item with the same key already exists

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Saaggs
    Junior Member
    • Dec 2022
    • 12

    #1

    SNMP discovery - Cannot create item: item with the same key already exists

    Good morning,
    I am trying to discover IPSEC tunnels from a fortigate and I have an error at the discovery rule level, it states that an item with the same key already exists. However, I've checked the host and cannot find the items.
    I've configured my discovery like this :
    Click image for larger version

Name:	image.png
Views:	598
Size:	22.8 KB
ID:	482443
    I am basically retrieving the snmp index and the name of the tunnel.

    Then I created this item :
    Click image for larger version

Name:	image.png
Views:	625
Size:	30.1 KB
ID:	482441
    I ensured to place the snmpindex at the end of the key so I'm sure its unique.
    I also tested the discovery​​, which returns : [{"{#SNMPINDEX}":"1.1","{#FGVPNTUNENTPHASE1NAME} ":" VPN-PA3-PAM94"},{"{#SNMPINDEX}":"2.1","{#FGVPNTUNENTPHASE1 NAME}":"VPN-KEO-VELIZY"},{"{#SNMPINDEX}":"3.1","{#FGVPNTUNENTPHASE 1NAME}":"VPN-MOB-STOUEN"}]
    And I am getting this error at the host level :

    Click image for larger version

Name:	image.png
Views:	599
Size:	14.4 KB
ID:	482442

    I don't understand why since the items do not exist on the host. I thought this was the host, but I have the same problem with another fortigate. Other discovery rules are working perfectly on both fortigate.
    I've been working on it for quite some time, even tried to reboot the server.
    Can anyone help ?
    Thanks!
    Attached Files
  • SanMonitor
    Member
    • Aug 2022
    • 48

    #2
    Hello Saaggs,

    can you try swapping {#FGVPNTUNETINDEX} with the built in macro {#SNMPVALUE} in the key and OID of your item prototype?

    Comment

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

      #3
      I also tested the discovery​, which returns :
      Code:
      [{"{#SNMPINDEX}":"1.1","{#FGVPNTUNENTPHASE1NAME} ":" VPN-PA3-PAM94"},{"{#SNMPINDEX}":"2.1","{#FGVPNTUNENTPHASE1 NAME}":"VPN-KEO-VELIZY"},{"{#SNMPINDEX}":"3.1","{#FGVPNTUNENTPHASE 1NAME}":"VPN-MOB-STOUEN"}]
      Your discovery data does not contain anything like {#FGVPNTUNENTINDEX}, so it is taken literally and you get the same key being created each time... Maybe you should use {#SNMPINDEX} instead?

      Comment

      • Saaggs
        Junior Member
        • Dec 2022
        • 12

        #4
        Good evening !
        It is working properly if I use the built-in macro {#SNMPINDEX}. I had no clue that there was a macro like this, this is fantastic because it makes the discovery rules cleaner and much better to read!
        The weird thing is that for the HA discovery on the same device it was working and returned the proper value but not for the VPNs. Anyway I've replaced all of the index by the macro.
        Thank you so much for your help guys!

        Comment

        Working...