[ZBX-13771] Duplicate Host Creation using Auto Registration + API Created: 2018 Apr 19  Updated: 2018 Apr 25  Resolved: 2018 Apr 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A), Server (S)
Affects Version/s: None
Fix Version/s: None

Type: Incident report Priority: Minor
Reporter: Larry Dorman Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: api, duplicates, host, registration
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Duplicated on Zabbix Server, Proxy, and Agent version 2.4.8, but probably possible in all 2.x+ versions. All LInux environment. MySQL db.


Attachments: Text File duplicate_host.log    
Issue Links:
Duplicate
duplicates ZBX-4134 It is possible to create duplicate ob... Confirmed

 Description   

I have automated my host creation by having a Chef recipe install the agent and call the Zabbix API to create and configure my hosts. However, I also had a leftover Auto Registration rule that matched the metadata. I ended up with two hosts with the exact same name added to the DB.

This seems to be a race condition of some sort. See attached debug level 4 server log.

Setting this as minor since few people are going to encounter this situation and it's easily avoided by getting rid of the auto registration rule. Mostly wanted to make you aware of a path to having duplicate hosts in case it suggests other concerns.

+--------+--------------+--------------------------+--------+--------------------------+-------+------------+-------------------------------------------------+
| hostid | proxy_hostid | host                     | status | name                     | flags | templateid | description                                     |
+--------+--------------+--------------------------+--------+--------------------------+-------+------------+-------------------------------------------------+
|  10425 |        10237 | duplicate.test.server.us |      0 | duplicate.test.server.us |     0 |       NULL | Managed by Chef - Any changes will be reverted. |
|  10427 |        10237 | duplicate.test.server.us |      0 | duplicate.test.server.us |     0 |       NULL |                                                 |
+--------+--------------+--------------------------+--------+--------------------------+-------+------------+-------------------------------------------------+


 Comments   
Comment by Dmitrijs Lamberts [ 2018 Apr 21 ]

Such cases indeed are possible. It is already known as
ZBX-4134.
Will close this one as a duplicate.

Comment by Larry Dorman [ 2018 Apr 25 ]

This is technically different...  this is an interaction with Auto Registration and a single call from the API vs. multiple concurrent API calls.  I'm moving entirely away from Auto Registration because if its severe shortcomings, but thought you might want to know that Auto Registration can result in duplicate hosts in rare cases.

Generated at Fri Apr 26 10:06:54 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.