Пример #1
0
        private void HandleAlertMonitoring(DatabaseAlert alert, DateTime lastCheckup, DateTime checkupDateTime)
        {
            //check if any persecondstat has a count higher than threshold since last checkup
            DatabasePerSecondStat earliestStatThatTriggersAlert
                = _databaseQueryService.GetEarliestPerSecondStatTriggeringAlert(alert, lastCheckup, checkupDateTime);

            if (earliestStatThatTriggersAlert != null)
            {
                LogManager.GetLogger("AlertMonitoringService").Info($"Following stat triggered {alert.AlertName}: " +
                                                                    $"{earliestStatThatTriggersAlert.NumDetectedObjects} at {earliestStatThatTriggersAlert.DateTime}");
                HandleTriggeringOfAlert(alert, earliestStatThatTriggersAlert);
                //Snooze alert so that it doesn't get retriggered constantly if it monitors a constantly busy area
                SnoozeAlert(alert);
            }
        }