[ZBX-15239] Hosts not auto deleted when not discovered anymore Created: 2018 Nov 30 Updated: 2018 Dec 11 Resolved: 2018 Dec 11 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Frontend (F) |
Affects Version/s: | 4.0.2 |
Fix Version/s: | None |
Type: | Problem report | Priority: | Trivial |
Reporter: | Gerard Beekmans | Assignee: | Unassigned |
Resolution: | Duplicate | Votes: | 0 |
Labels: | None | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Issue Links: |
|
Description |
Zabbix 4.0.2, running on Ubuntu 18.04 with a PostgreSQL 10 database. I had initially installed version 3.4 then subsequently upgraded to 4.0.0 and then 4.0.2 using the instructions provided in the manual. I am trying to get the feature working where hosts are automatically deleted when they are no longer part of the discovery rule's IP range. It seems my hosts are never deleted and at the same time I can fully edit the host's details where it used to be read-only. Looking through the frontend PHP code, I notice a number of checks are done for ZBX_FLAG_DISCOVERED_CREATED along with checks for ts_delete. This is to indicate when hosts are scheduled to be deleted and to identify the ones that were created through a discovery rule? I might be misunderstanding the purpose of the flags. I see the database has a "flags" column in the "hosts" table but all my values are 0. When I set hosts I expected to be deleted to a flags value of "4" (which is the value I found in include/defines.inc.php) then the various fields on the Host Edit page do become read-only along with these error messages displayed:
I still don't notice any hosts being deleted even when re-running the discovery rules several times. I can't be sure of course that setting that one table entry is enough for this to work. I am seeing "undefined index" warnings on several pages. Are these expected or is this a sign of an upgrade maybe having gone wrong? I am willing to install Zabbix 4.0.2 from scratch but I would like some direction on how to save all the actions, triggers and network discovery rules I've created. Templates I can export and later on import again, but all those other item I can't seem to export. |
Comments |
Comment by richlv [ 2018 Nov 30 ] |
It seems that you are talking about network discovery. Currently there is no way to auto-remove hosts, created by it. |
Comment by Gerard Beekmans [ 2018 Nov 30 ] |
Can you double-check that? The host removal is mentioned in the manual on this page: https://www.zabbix.com/documentation/4.0/manual/discovery/network_discovery
This is on the Network Discovery page, not the Low Level Discovery one. This is what I've been trying to get to work for a while now. ZBXNEXT-1387 itself mentions in its description that Currently this is only supported via a discovery rule that only works if you scan an IP address. – it doesn't delete anything on my installation. Based on the manual and ticket I believe something is not working correctly in my installation. Is the manual perhaps wrong and this behaviour has been removed since the 2.4.0 version and the chapter hasn't been updated accordingly? |
Comment by richlv [ 2018 Nov 30 ] |
I might have misunderstood the issue - have you modified discovery rules and thus excluded some network-discovery-created hosts from the discovery rule ranges? |
Comment by Gerard Beekmans [ 2018 Nov 30 ] |
Yes I modified the discovery rule (made sure to not disable the rule altogether) to discovery a different IP range. The devices in the new range showed up as Discovered Hosts so that part is working. The original discovered host did not get deleted. I have set the discovery interval to 1 minute and let it run many times over the last hour. Nothing has been deleted. I have also installed Zabbix 4.0.2 on a brand new VM and installed it from scratch using the online instructions so there is no case of an upgrade gone wrong. I have not made any modifications to the stock installation. This fresh install is behaving the same way. |
Comment by richlv [ 2018 Nov 30 ] |
I don't recall this in detail, but wondering whether the documentation might be incorrect here, and the deleted thing actually would be dhost entries as per |
Comment by Gerard Beekmans [ 2018 Nov 30 ] |
I can confirm that Monitoring -> Discovery get removed. The manual is probably a little misleading in that it sounds like it talks about Configuration -> Hosts area. I have seen many open tickets from people requesting that kind of feature - automatic cleanup of hosts that have gotten stale. Suggestions are made to write scripts and use API calls to do that kind of cleanup which can run periodically through cron. Not a terrible idea in and of itself but it would be nicer if this can be setup and controlled from within the web GUI instead/as well. |
Comment by Arturs Lontons [ 2018 Dec 11 ] |
Hello and thanks for reporting this issue. In its core this looks like an issue with imprecise documentation. The "Host Removal" subsection should probably be more specific regarding where the hosts are being removed from in Zabbix as to not raise any further similar questions. I will create a separate documentation task regarding this issue for our team and will be closing this issue for now. |
Comment by richlv [ 2018 Dec 11 ] |
This has been closed as a duplicate, but the issue linkage says it "is duplicated by" the other issue. Most likely the intent was to have the duplicate linkage be the other way around - could that please be fixed? |