Ad Widget

Collapse

Discovery item key exists in database, but not in UI or API

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • inventor96
    Junior Member
    • Dec 2021
    • 13

    #1

    Discovery item key exists in database, but not in UI or API

    I've encountered an interesting issue with the MySQL Replication Discovery rule where it's failing to execute, returning the message:
    Code:
    Cannot create item: item with the same key "mysql.slave_sql_running_state["{#MASTER_HOST}"]" already exists.
    This applies to multiple hosts in our environment (I haven't check all of our hosts that use the MySQL template, but it's enough that I would guess it's all of them). I've scoured the UI to find the existing item, but I have not found it. I've also used the API to do the same, and also found none. Only after logging in to MySQL on the Zabbix server could I find the existing items. The only recent change that I'm aware of in the template was to change the severity of a number of the trigger prototypes. I'm not 100% sure the timing of this error showing up compared to the change of the severities, so it may not be related.

    So there's two questions with this:
    1. Could the severity change have somehow caused the items to get unlinked from the host/template/discovery rule, but still be present enough to cause the duplication issue? As far as I've been able to tell, all of the remaining item prototypes have generated correctly on the hosts I've looked at, so I'm not sure what's so unique about this particular item...
    2. How do I go about fixing this? Is there a way to re-link the items in the db with the host/template/discovery rule? Would it be better to manually delete the applicable rows in MySQL?
  • inventor96
    Junior Member
    • Dec 2021
    • 13

    #2
    After banging my head on the issue all day, I think I finally found the underlying problem! In the discovery item's key, there's a macro referencing a value from the LLD results. For this item, that was "MASTER_HOST", while all of the other items in the same discovery rule were "MASTERHOST" (no underscore). When there's not a value to replace the macro, Zabbix keeps the placeholder as-is, and since the template item was attached to the host, it already "existed", but it was only in Zabbix's server database. Since it technically existed, Zabbix couldn't create the discovery item with the macro being left as-is.

    Moral of the story: if you're having an issue where Zabbix is complaining about an existing item from a discovery rule, but you can't find that item, double check the macros in the item's key.
    Last edited by inventor96; 01-03-2024, 02:29.

    Comment

    Working...