MCPcopy Create free account
hub / github.com/Icinga/icinga2 / CleanUpHandler

Method CleanUpHandler

lib/db_ido/dbconnection.cpp:230–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230void DbConnection::CleanUpHandler()
231{
232 auto now = static_cast<long>(Utility::GetTime());
233
234 struct {
235 String name;
236 String time_column;
237 } tables[] = {
238 { "acknowledgements", "entry_time" },
239 { "commenthistory", "entry_time" },
240 { "contactnotifications", "start_time" },
241 { "contactnotificationmethods", "start_time" },
242 { "downtimehistory", "entry_time" },
243 { "eventhandlers", "start_time" },
244 { "externalcommands", "entry_time" },
245 { "flappinghistory", "event_time" },
246 { "hostchecks", "start_time" },
247 { "logentries", "logentry_time" },
248 { "notifications", "start_time" },
249 { "processevents", "event_time" },
250 { "statehistory", "state_time" },
251 { "servicechecks", "start_time" },
252 { "systemcommands", "start_time" }
253 };
254
255 for (auto& table : tables) {
256 double max_age = GetCleanup()->Get(table.name + "_age");
257
258 if (max_age == 0)
259 continue;
260
261 CleanUpExecuteQuery(table.name, table.time_column, now - max_age);
262 Log(LogNotice, "DbConnection")
263 << "Cleanup (" << table.name << "): " << max_age
264 << " now: " << now
265 << " old: " << now - max_age;
266 }
267
268}
269
270void DbConnection::LogStatsHandler()
271{

Callers

nothing calls this directly

Calls 2

LogClass · 0.85
GetMethod · 0.45

Tested by

no test coverage detected