コード例 #1
0
        public async Task ProcessQueueMessage([TimerTrigger("%MonitoringInterval%" /*, RunOnStartup = true*/)] TimerInfo timerInfo, TextWriter log)
        {
            try
            {
                var msg = "Start monitor: " + DateTime.Now;

                logger.LogInformation(msg);

                //monitoring.CheckMonitors(serviceProvider);

                await notificator.SendAllNotifications();
            }
            catch (Exception ex)
            {
                string email = NotificationEmailOnError;
                if (email != null)
                {
                    await emailNotificator.SendEmailAsync(email, "!!! MONITORING WEBJOB DOWN !!!", "Console application to monitoring websites is down."
                                                          + $"{Environment.NewLine}Exception:{Environment.NewLine}" + ex.ToString());
                }
            }
        }