-
Incident report
-
Resolution: Fixed
-
Critical
-
2.0.7rc1
First of all - it's reproducible for both - network discovery and auto registration.
It's a bit easier to reproduce it for auto registration (less configuration required).
For both cases you can find related Debuglog in attachments.
Conditions:
We have an active zabbix proxy (Administration -> DM)
We have an auto registration action with 3 operations: link to "Template App Zabbix Agent", Add host, Add to host group..
Our active proxy has a name "it0proxy" and our zabbix active agent which will connect to zabbix server also has the same name "it0proxy"
Nothing fantastic, it's absolutely real case in host naming approach. For example it's a Zabbix agent working an a Proxy and used name for the Proxy identically to host's name.
Problem:
When server links newly auto registerd/discovered host to a template it doesn't check its status and if there is a proxy (status=5,6) wit the same name then server will not add a Zabbix host but will link the template to the existing Proxy which is wrong.
Incorrect query is:
15861:20130626:105815.078 query [txnlev:1] [select hostid,proxy_hostid from hosts where host='it0proxy' and hostid between 0 and 99999999999999 order by hostid limit 1]
The same for network discovery.
Just host name in this case is "it0.local"
How to manually fix wrong proxy host:
Find out the proxy id (hostid column) in corresponding frontend URL,
Query to check is this proxy used for other zabbix host as "monitored by proxy":
> SELECT * FROM hosts WHERE proxy_hostid='10134';
If output is empty then you safely can perform:
> UPDATE hosts SET name=host, status=1 WHERE hostid='10134';
and then the Proxy will appear in "Configuration -> Hosts" menu as a Zabbix host (you can then see all the triggers described bellow) and you can successfully delete it there.
If the proxy is already used for another host I would recommend to create new Proxy host, switch all required zabbix host to be monitored by this new proxy and then remove the wrong proxy as I've described above.
It looks to me like a more safe approach than figuring out what need to delete in database manually (remember about items/triggers/graphs and all relations).
Also remember that wrong proxy could be used in different actions.
Frontend side:
When I try to delete the Active proxy I'm getting this error in frontend:
Error in query [DELETE FROM interface WHERE hostid='10134'] [Cannot delete or update a parent row: a foreign key constraint fails (`zabbix20`.`items`, CONSTRAINT `c_items_4` FOREIGN KEY (`interfaceid`) REFERENCES `interface` (`interfaceid`))]
SQL statement execution has failed "DELETE FROM interface WHERE hostid='10134'" [CProxy.delete -> DB.delete]
As expected: frontend doesn't check/delete possible existing items (linked to interface) on a Proxy host.
Explanation: DB server tries to delete interface (as constraint) but according to another constraint the interface cannot be deleted because there are items linked to it.
Interesting things happens then if I've created regular zabbix host with the same name "it0proxy" and manually linked the "Template App Zabbix Agent" to it.
Here is Details after host saving:
Created: Application "Zabbix agent" on "it0proxy".
Created: Item "Host name of zabbix_agentd running" on "it0proxy".
Created: Item "Agent ping" on "it0proxy".
Created: Item "Version of zabbix_agent(d) running" on "it0proxy".
Created: Trigger "Host name of zabbix_agentd was changed on
Created: Trigger "Zabbix agent on {HOST.NAME}
is unreachable for 5 minutes" on "".
Created: Trigger "Version of zabbix_agent(d) was changed on
" on "".
Note missing host name "" for triggers.
Then in frontend in hosts list I see zero for triggers count for the host.
This is because frontend created triggers which linked to incorrect Proxy's items (I've checked this in my DB) which have been created previously by zabbix server during the auto-registration.
If I delete this Zabbix host - in Details I see only Items deleted, it's logical.
It looks like another frontend bug which also has to be fixed.