The question I have is around clean up of comment_history and how to fix it in this system.
The system details are
icingadb: 1.4.0
icinga2: 2.15.0
The system has around 20,000 hosts and 80,000 services and is processing around 1.35 million checks per hour.
Obviously this is a very busy system which generates a lot of history. Clean up is critical.
Icinga DB retention is 90 days
retention:
history-days: 90
sla-days: 90
interval: 1m
Comments are created via the Icinga2 API, we are (now
) very careful around setting expiry times on comments, as a result there is around 24,000 comments in the database with none being more than 90 days old (the value we set comment expiry times to).
But the comment history in the database is showing around 280,000 comments the oldest being September 2024, well past the 90 days.
All the entries in the comment_history table have a entry_time and none of them have a remove_time. This includes comment history that is orphaned, ie it has no comment in the comment table, or not orphaned comment history.
Note only comment history that is less that 90 days old has linked comments
I’m not sure if the excessive retention of comment history is
- By IcingaDB design
- Because retention isn’t configured correctly
- Because comment_history should have a
remove_timeand isn’t being set (I’m not sure how this would get set) - If it is safe to manually clean up orphaned comment_history directly in the database
We have created db clean up script for director because it’s retention clean up can’t keep up, so it would fit in with the processes used to manage this system to manually delete orphaned comment_history if it is safe to do so