Applying Cleanup Policies

Hi all,

I’m running r2.12.3-1 in a HA environment with two masters and satellites across four zones.

We have 3m rows in the icinga_statehistory table with the earliest row coming from January 2020, so yesterday I applied a cleanup policy of 400 days.

However, the rows have only grown since. I’ve been searching the docs without any joy as to whether it’s scheduled or triggered, and if the latter, how to trigger it. Could anyone tell me when or how the cleanup policy takes effect? (Or if I’ve got the config wrong.)

Thanks in advance!

object IdoMysqlConnection "ido-mysql" {
  user = "XXX",
  password = "XXX",
  host = "127.0.0.1",
  database = "icinga2"
  cleanup = {
    statehistory_age = 400d
  } 
}

Hi,
the config looks good to me. We are doing the same and works fine.

Did you restart the icinga2 daemon after your change?

Yes (sorry for delayed reply, I thought I had notifications enabled but obviously not!).

We enabled debug log and could see where job was being attempted by Icinga.

We attempted to run the command manually and discovered that the deletion job was too large for the database server to handle. We ran the commands in smaller batches, and hopefully Icinga will be able to apply the policy without issue in future.