[ZBXNEXT-2935] Housekeeper option to remove orphan items from history Created: 2015 Aug 31  Updated: 2015 Sep 01

Status: Reopened
Project: ZABBIX FEATURE REQUESTS
Component/s: Server (S)
Affects Version/s: None
Fix Version/s: None

Type: Change Request Priority: Minor
Reporter: Harry Coin Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: database, housekeeper, orphaned
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All


Attachments: JPEG File Screenshot_2015-08-31_10-49-57.jpg    

 Description   

I've found over a period of years a zabbix-server + mysql combination will cause this query, which should be empty, to nevertheless find a dozen or so items corresponding to millions of orphaned history rows. Housekeeping runs complete without removing these.

select distinct(itemid) FROM `history` where itemid not in (SELECT itemid FROM `items`);

I could be missing some zabbix use case, zabbix is not my primary focus. Maybe there's a 'retired item' table somewhere. But if I'm not, for those of us who would rather have the database space than retain a history of deleted items, consider adding a housekeeping flag to delete such orphans automatically. Perhaps a database rule to cause item deletes to cascade delete related history entries?

Finally, my appreciation for creating and supporting such a useful tool!



 Comments   
Comment by richlv [ 2015 Aug 31 ]

see housekeeper table, it holds a list of deleted items and housekeeper deletes all data for those items following different rules. i guess we can close this issue then - please reopen if there's still a need to do something

Comment by Harry Coin [ 2015 Aug 31 ]

Kindly note the housekeeper has been running for the same years these orphan items exist. Before posting I double checked to make sure the housekeeper completed its run, changing the number of items to process per run to unlimited. Even when that had completed, these history entries describing events that happened to itemids not in the items table remained. I rebooted a few times, let the housekeeper complete, and yet millions of records referring to item record ids not in the items table remain.

So, closing this item on the basis the housekeeper would take care of it needs further explanation.

Comment by Harry Coin [ 2015 Aug 31 ]

See reply above.

Comment by richlv [ 2015 Aug 31 ]

in general, it would be best to discuss things like this in one of the options at https://www.zabbix.org/wiki/Getting_help - irc would be a great place - but in any case, you did not specify zabbix version. if it's a recent one and you have upgraded, check that housekeeper is enabled at all in administration -> general -> housekeeping

Comment by Harry Coin [ 2015 Aug 31 ]

I do think the housekeeper has been properly enabled and configured. Note the version is also in the shot, 2.2.

Comment by Harry Coin [ 2015 Aug 31 ]

Really, just a feature request for an option to delete all references everywhere to items that no longer exist.

Comment by richlv [ 2015 Sep 01 ]

as noted, that is supposed to happen already. please use https://www.zabbix.org/wiki/Getting_help to discuss the details, until a specific bug or feature request can be reported.

Comment by Harry Coin [ 2015 Sep 01 ]

Also as noted, though it was supposed to happen, it was not happening. So here we are on this page where I think it's created to ask for features.

To be clear: The feature requested is a server command line one-of recovery option to delete every orphan item in the database and generally not proceed until the database is in a known consistent state.

Having done this manually, finding a few thousand orphan records in trends* and several million orphan records in history* not mentioned in houskeeper and also not in items I think I've presented a reasonable use case. Look at it this way, if the server flag finds nothing to do it can act as an integrity check and so give confidence the server is about to begin operations on a known-good platform.

It's a reasonable enough feature request IMHO.

Comment by Oleksii Zagorskyi [ 2015 Sep 01 ]

Not absolutely sure, but there can be other use cases.
For example we delete a child node (which passed its history to master) on master.
As I recall it was discussed already in other issues.

Generated at Fri Apr 26 17:38:37 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.