[ZBX-4134] It is possible to create duplicate objects using API in parallel requests Created: 2011 Sep 12 Updated: 2023 Jan 04 |
|
Status: | Confirmed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | API (A), Frontend (F) |
Affects Version/s: | 1.8.5, 3.0.5, 3.2.0 |
Fix Version/s: | None |
Type: | Problem report | Priority: | Critical |
Reporter: | Igor Danoshaites (Inactive) | Assignee: | Alexei Vladishev |
Resolution: | Unresolved | Votes: | 19 |
Labels: | api, consistency, duplicates | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: | Zabbix_DB_hosts_table.png duplicate_hosts_created_using_API.png host1.png host2.png hosts.png proxies.png triggers.png | ||||||||||||||||||||||||||||||||||||||||
Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||
Team: | Team A |
Description |
It is possible to create hosts with duplicate hostnames using API, when several simultaneously running processes are trying to create hosts with the same name. We should think about the possibility how to get rid of such cases. |
Comments |
Comment by ojab [ 2012 Nov 17 ] | ||||||||
I have the same issue with Graphs on zabbix-2.1.0 (it's possible to create graphs with duplicate names and the same host using API). | ||||||||
Comment by richlv [ 2012 Nov 17 ] | ||||||||
yes, please do so (unless it's reported already) | ||||||||
Comment by ojab [ 2012 Nov 17 ] | ||||||||
Done, | ||||||||
Comment by Oleksii Zagorskyi [ 2016 Dec 06 ] | ||||||||
A practical way how to reproduce it: curl -i -X POST -H 'Content-Type: application/json-rpc' -d '{"params": {"rules": {"templateLinkage": {"createMissing": "true"}, "hosts": {"createMissing": "true", "updateExisting": "true"}, "groups": {"createMissing": "true"}}, "source": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><zabbix_export><version>2.0</version><date>2015-09-15T23:41:53Z</date><groups> <group><name>Load Balancer</name> </group></groups><hosts> <host><host>Load Balancer node100</host><name>Load Balancer node100</name><description>satellite Load Balancer: node100 </description><proxy/><status>0</status><ipmi_authtype>-1</ipmi_authtype><ipmi_privilege>2</ipmi_privilege><ipmi_username/><ipmi_password/><groups><group><name>Load Balancer</name></group></groups><interfaces><interface><default>1</default><type>1</type><useip>1</useip><ip>10.33.0.100</ip><dns></dns><port>10050</port><bulk>1</bulk><interface_ref>if1</interface_ref> </interface></interfaces><applications/><items/><discovery_rules/><macros/><inventory/> </host></hosts></zabbix_export>", "format": "xml"}, "jsonrpc": "2.0", "method": "configuration.import","auth": "f45f05ddc5558a7c3a1c72db15162a20", "id": 0}' http://localhost/zabbix/api_jsonrpc.php & \ curl -i -X POST -H 'Content-Type: application/json-rpc' -d '{"params": {"rules": {"templateLinkage": {"createMissing": "true"}, "hosts": {"createMissing": "true", "updateExisting": "true"}, "groups": {"createMissing": "true"}}, "source": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><zabbix_export><version>2.0</version><date>2015-09-15T23:41:53Z</date><groups> <group><name>Load Balancer</name> </group></groups><hosts> <host><host>Load Balancer node101</host><name>Load Balancer node101</name><description>satellite Load Balancer: node101 </description><proxy/><status>0</status><ipmi_authtype>-1</ipmi_authtype><ipmi_privilege>2</ipmi_privilege><ipmi_username/><ipmi_password/><groups><group><name>Load Balancer</name></group></groups><interfaces><interface><default>1</default><type>1</type><useip>1</useip><ip>10.33.0.100</ip><dns></dns><port>10050</port><bulk>1</bulk><interface_ref>if1</interface_ref> </interface></interfaces><applications/><items/><discovery_rules/><macros/><inventory/> </host></hosts></zabbix_export>", "format": "xml"}, "jsonrpc": "2.0", "method": "configuration.import","auth": "f45f05ddc5558a7c3a1c72db15162a20", "id": 0}' http://localhost/zabbix/api_jsonrpc.php note - replace auth token by yours. This example creates duplicated host groups. I've faced with this because I use ansible for a fully automated deploying of zabbix installations with some pre-configuration. | ||||||||
Comment by Oleksii Zagorskyi [ 2017 Feb 03 ] | ||||||||
| ||||||||
Comment by Oleksii Zagorskyi [ 2017 Feb 10 ] | ||||||||
Similar problem for server side reported in | ||||||||
Comment by Dmitry Verkhoturov [ 2017 Feb 21 ] | ||||||||
This bug results in "Template cannot be linked to another template more than once even through other templates." messages, I've created a patch for 3.0 and 3.2 which show templateid which causes the problem in error message. | ||||||||
Comment by Oleksii Zagorskyi [ 2017 Feb 21 ] | ||||||||
How can you prove that duplicated objects caused the error message ? | ||||||||
Comment by Dmitry Verkhoturov [ 2017 Feb 21 ] | ||||||||
In my case something impossible by Zabbix logic was done via API, which is a bug and I think it is this very bug (it might be not). I am not reporting the bug or adding any information to it, I just giving away a troubleshooting improvement which might help to locate the problem. | ||||||||
Comment by Oleksii Zagorskyi [ 2017 Feb 21 ] | ||||||||
My doubts are directed to the reason why did you get the error message. | ||||||||
Comment by Minjie Zhang [ 2017 May 05 ] | ||||||||
I have the same issue, multiple hosts created with the same name. | ||||||||
Comment by Oleksii Zagorskyi [ 2019 Jan 25 ] | ||||||||
Multiple entries for ServerActive (localhost and another interface IP) cause duplicated host names creation during agents auto-registration. | ||||||||
Comment by Oleksii Zagorskyi [ 2020 Jun 25 ] | ||||||||
One more visible sub-issue: | ||||||||
Comment by dimir [ 2022 Jun 13 ] | ||||||||
After discussion with asitals: How about splitting current status column. Current implementation
Suggested implementationSplit current status column that mixes host/proxy status and the type of the record into 3 dedicated columns:
Pros:
Cons:
Questions:
|