Delete Monitor_Status records that havn't been updated in over a minute.

This commit is contained in:
Isaac Connor
2024-05-19 10:26:48 -04:00
parent 51f91fb151
commit eedb0b97cf

View File

@@ -79,8 +79,8 @@ while (!$zm_terminate) {
Debug("Deleted $rows Server Stats table entries by time");
}
# Clear out statuses for Monitors that have been set to None but for some reason didn't update the db
zmDbDo('DELETE FROM Monitor_Status WHERE MonitorId IN (SELECT Id FROM Monitors WHERE Capturing=\'None\')');
# Clear out statuses for Monitors that aren't updating themselves.
zmDbDo('DELETE FROM Monitor_Status WHERE UpdatedOn < timestamp(DATE_SUB(NOW(), INTERVAL 1 MINUTE))?');
zmDbDo('DELETE FROM Events_Hour WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 hour)');
zmDbDo('DELETE FROM Events_Day WHERE StartDateTime < DATE_SUB(NOW(), INTERVAL 1 day)');