[ZBX-3286] Ability to automatically/manually delete discovered resources (low level discovery). Created: 2010 Dec 13  Updated: 2017 May 30  Resolved: 2011 Dec 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F), Server (S)
Affects Version/s: 1.9.1 (alpha)
Fix Version/s: 1.9.9 (beta)

Type: Incident report Priority: Blocker
Reporter: Oleksii Zagorskyi Assignee: Unassigned
Resolution: Fixed Votes: 13
Labels: discovery, lld
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

latest trunk


Attachments: Text File zabbix_server_demo_R23852.log    
Issue Links:
Duplicate
is duplicated by ZBX-4592 When using low level discovery in a t... Closed

 Description   

Now the auto-added resources (items, triggers) can not be deleted. Only graph can be manually deleted - i think tis is bug.

Need to come up with a mechanism for automatic/manual removal of obsolete resources.
By obsolete, I mean:
resources that belong to the prototype, but is no longer discovered (for example we delete VLAN);
resources that have ceased to pass through the filter of the macros (various examples).
This should be an option in the settings of the rule - whether to delete obsoleted resources automatically.

I do not have a clear vision of how it should look, but I think that should be able to manually remove these obsolete resources, for example they should be made available for manual deletion (not obsolete resources should stay unavailable for deletion). This is the case if automatic deletion is not enabled.

as discussed with Aleksandrs Saveljevs i mark this issue as "blocker"



 Comments   
Comment by Paxos [ 2011 Apr 27 ]

Having the same issue with 1.9.3.

I think the current logic of keeping auto-generated resources around after they disappear from discovery is the way to go.

However, these items must be able to be removed manually and not auto-removed.

Comment by Marcin GapiƄski [ 2011 Oct 14 ]

It would be great if there was an option to choose what to do when discovered item is no longer present.

I can think of two possible scenarios: delete that item automatically or disable it and allow for manual removal. That would certainly decrease resources usage on rapidly changing monitoring environment.

Comment by Yoav Steinberg [ 2011 Nov 08 ]

I'd really like to see an option to auto remove discovered items. For things like file system or net interfaces this might not be critical, and we might want to continue seeing these items after we remove them. But other use cases like for monitoring instances of a process on a system that spawn new processes based on some external input (rapidly changing system) there should be an option to automatically delete the discovered items after they disappear.

Comment by Alexei Vladishev [ 2011 Nov 16 ]

A new global (Administration->General->???) configuration parameter will define life time of lost items. If an item exceeds the period, it will be removed and a new record for housekeeper will be added as well.

Comment by Alexey Pustovalov [ 2011 Nov 21 ]

maybe do better not global? host level or discovery?

Comment by richlv [ 2011 Nov 21 ]

lld rule level would seem to be most appropriate. for example, we might have a host which has network interfaces quite rapidly changed, thus we know that interface going down would allow us to mostly safely remove it after 3 days. on the other hand, disk volumes going away would be less frequent, and data would be more important in the long term, thus we would like to have those items only removed after 2 weeks have passed

Comment by Alexei Vladishev [ 2011 Nov 23 ]

Sure, it's better to keep it on lld level with support of user macros (template, host, global).

Comment by Alexey Fukalov [ 2011 Dec 05 ]

New field "lifetime varchar(64)" is added to "items" table. Allows usermacro or number in days.
New input field is added to discovery rule form before "status".

Comment by Pavels Jelisejevs (Inactive) [ 2011 Dec 06 ]

(1) GUI
I think we should replace the maximum (and, maybe, minimum) lifetime with constants in the CDiscoveryRule::checkSpecificFields() and CDiscoveryRule::validateLifetime() methods and try to avoid using literal constants in the future.

Same for validatePortNumber()

<Vedmak> RESOLVED

<pavels> CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2011 Dec 06 ]

(2) GUI
Shouldn't the clearValues() method in CItemGeneral::checkInput() and CHostInterface::checkInput() be called before the validation is performed? What's the point of cleaning up values, if they are already OK?

<Vedmak> RESOLVED

<pavels> CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2011 Dec 06 ]

(3) GUI
Please review my changes in r23788 and r23789.

<Vedmak> CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2011 Dec 06 ]

(4) DOC
The docs should also be udpated
http://www.zabbix.com/documentation/internal/database_2.0/items
http://www.zabbix.com/documentation/2.0/manual/discovery/low_level_discovery

<Vedmak> I'll update db and api docs, and put separate paper on the board for it.

<pavels> Db and API docs are ok. CLOSED.

Comment by Alexander Vladishev [ 2011 Dec 06 ]

(5) [DB] DB patches
upgrades/dbpatches/2.0/postgresql/patch/hosts.sql:64 - incorrect SQL statement delimiter
upgrades/dbpatches/2.0/oracle/patch/hosts.sql:64 - useless constraint 'NOT NULL'

<Vedmak> RESOLVED
<sasha> CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2011 Dec 06 ]

(6) GUI
When cloning a discovery rule or full cloning a host an error occurs:
"Discovery rule "lld22-2:lld2" has incorrect lifetime: "". (min: 0, max: 3650, user macro allowed)"

<Vedmak> RESOLVED

<pavels> CLOSED.

Comment by Alexander Vladishev [ 2011 Dec 06 ]

(7) [GUI] when creating/updating a discovery rule with 'Keep lost resources period (in days)' = 0 an error occurs:
Discovery rule "vfs.fs.discovery:vfs.fs.discovery" has incorrect lifetime: "". (min: 0, max: 3650, user macro allowed)

<Vedmak> RESOLVED

<pavels> CLOSED.

Comment by richlv [ 2011 Dec 06 ]

(8) api docs (to avoid overloading (4))
a) having http://www.zabbix.com/documentation/2.0/manual/appendix/api/discoveryrule is great, but to be consistent i guess there shouldn't be space in the page title (not sure about capitalisation)

b) also should be listed at http://www.zabbix.com/documentation/2.0/manual/appendix/api/changes_1.8_-_2.0

<Vedmak> RESOLVED

<richlv> do we have a rule on class naming ? because now we have "TemplateScreen" and "Discoveryrule" - would be nice to settle on either camelcase or something.
hmm, changes page actually says "DiscoveryRule" - which one is correct then ?

<zalex> last question moved to ZBXNEXT-1058
CLOSED

Comment by Pavels Jelisejevs (Inactive) [ 2011 Dec 07 ]

GUI is TESTED.

Comment by Alexander Vladishev [ 2011 Dec 07 ]

A server side is ready to test!

<dimir> Great! Please review my changes that allow it to work without graph prototypes in r23965 .

Comment by Oleksii Zagorskyi [ 2011 Dec 08 ]

I could not to not test the dev branch ASAP
Server side tested. Seems it works.
A part of the debuglog attached.

>>> 15557:20111208:010525.923 poller #1 spent 2.178640 seconds while updating 1 values
it's ok because tested SNMP device is partially slow:

  1. time snmpwalk -c scarysecret -v 1 10.20.0.5 IF-MIB::ifAlias
    .....~40 result records ....

real 0m1.965s
user 0m0.344s
sys 0m0.016s

Comment by Oleksii Zagorskyi [ 2011 Dec 08 ]

(9) An item, has been not passed through the filter but doesn't deleted yet, still continue to be monitored:

mysql> select i.lastclock, d.lastcheck from items i, item_discovery d where i.itemid=25905 and i.itemid=d.itemid;
----------------------+

lastclock lastcheck

----------------------+

1323302205 1323298285

----------------------+

Is it ok by design?

added:
For instance, how an user can understand that after he changed the Regexp previously discovered and added resources currently are not passing by filter?
So if a gathering the data will be stopped then it could be some "indicator" that the resources are not discovered anymore an they going to be deleted in N days.

How is else the user can understand that some resources are not discovered anymore?

<zalex> some part moved to the ZBXNEXT-1058, some to the ZBX-4475
CLOSED

Comment by Oleksii Zagorskyi [ 2011 Dec 08 ]

(11) I would suggest to change default value 0 days for "Keep lost resources period (in days)" to for instance 1 day when an user creates new discovery rule.
Try to imagine the case when the user creates discovery rule and forgot to change 0 to the value>=1.
Later he or someone else wrongly changes Regexp of discovery rule and all historical data can be unexpectedly lost in one moment (when discovery will be performed by the zabbix_server next time).

It's danger behavior. The user has to set 0 day only when he is understanding what he doing.

<zalex> moved to ZBXNEXT-1058
CLOSED

Comment by Ghozlane TOUMI [ 2011 Dec 09 ]

Hi.
the method I suggested in ZBXNEXT-925 could be an answer :
you could add a 'layer' between discovery and actual item creation, where user could see with some kind of status

  • the currently discovered ressources
  • the previously discovered ressources no longuer present, both with the date of last discovery
  • and eventualy the manualy added ressources.( wich was the main request for the ZBXNEXT-925)

That way the user can choose between automatic and manual creation / deletion,
see what's going on with the discovery, manage the ressources by disabling / removing ressources.

That could allow some nw use cases like :
deactivate after an initial run the discovery and keep it's ressources ,
use the lld structure with manualy entered ressources etc.

Comment by dimir [ 2011 Dec 14 ]

Note, until ZBX-4425 is merged into trunk the server side will not work in this development branch. Meanwhile you can apply this patch:

svn diff svn://svn.zabbix.com/branches/dev/ZBX-4425 -c r23945

in order to test it.

Comment by Alexey Fukalov [ 2011 Dec 21 ]

merged: svn://svn.zabbix.com/trunk 24129

Comment by Alexey Fukalov [ 2011 Dec 21 ]

Additional improvements will be implemented in ZBXNEXT-1058

Comment by Oleksii Zagorskyi [ 2011 Dec 21 ]

Reopened to close (move) some comments;
to remove 2.0 from Fixversion.

Comment by Oleksii Zagorskyi [ 2011 Dec 21 ]

Closed again.

Comment by Nelson Rotunno [ 2014 Jul 29 ]

I've been looking around on the forums and whatnot and it seems like there is still no way to manually delete discovered resources, it would be great to see that added.

At least in my case, many (nearly 30) unnecessary network interfaces are added via the discovery rule and even though it is possible to disable the new items as a whole, I find this rather "polluting" to my setting.

I see no reason to leave those items there and I can't just recreate the host since I want to keep its historical data. Besides, those items won't get scheduled for auto cleanup because they're still discovered, I simply don't want them around anymore.

Generated at Mon Jun 09 08:19:55 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.