-
Incident report
-
Resolution: Won't fix
-
Minor
-
None
-
2.0.3
-
Zabbix server 2.0.3
Debian 6.0
Apache 2
MySQL server 5.1.49-3
When using the API to create a host (host.create), if the user (or the script) specify two times the same hostgroup ID the query fails:
zabbix_api.ZabbixAPIException: (u'Error -32500: Application error., SQL statement execution has failed "INSERT INTO hosts_groups (hostid,groupid,hostgroupid) VALUES (\'12221\',\'57\',\'6927\')". while sending {"params": {"proxy_hostid": "10085", "name": "SXXXXXXXXXXXI", "interfaces": [{"ip": "10.XXX.XX.1", "useip": 1, "dns": "", "main": 1, "type": 2, "port": "161"}], "host": "SXXXXXXXXXX1", "inventory": {"location_lat": "X.XXXXX", "site_address_c": "3", "site_address_b": "2", "site_address_a": "XXXXXXXXX", "location_lon": "XXXXXXXX", "location": "XXXXXXXXXX"}, "groups": [{"groupid": "6"}, {"groupid": "43"}, {"groupid": "57"}, {"groupid": "405"}, {"groupid": "57"}, {"groupid": "10"}]}, "jsonrpc": "2.0", "method": "host.create", "auth": "1e47807fe04b2c57690701aba3e58b60", "id": 7}', -32500)
We can see that the JSON array contains two times the groupid '57'.
I know this query is not well formed, but it should not failed.
Ideally it should only add the host in the hostgroup one time.