protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            Logger.Debug("Health check background service is starting");

            stoppingToken.Register(() =>
                                   Logger.Debug("Health check background service is stopping."));

            while (!stoppingToken.IsCancellationRequested)
            {
                try
                {
                    using var scope = _serviceProvider.CreateScope();
                    var serverDal          = scope.ServiceProvider.GetService <IServerDal>();
                    var cloudProviderDal   = scope.ServiceProvider.GetService <ICloudProviderDal>();
                    var healthCheckDal     = scope.ServiceProvider.GetService <IHealthCheckDal>();
                    var healthCheckManager = new HealthCheckManager(healthCheckDal, serverDal, cloudProviderDal);

                    var result = healthCheckManager.RunHealthChecks();
                    Logger.Info(
                        result ? "Health checks ran successfully" : "Health checks did not run successfully");
                }
                catch (Exception e)
                {
                    Logger.Error(e);
                }

                await Task.Delay(TimeSpan.FromMinutes(BackgroundServiceHelper.HealthCheckDelay), stoppingToken);
            }

            Logger.Debug("Health check background service is stopping.");
        }
    public override void CreateStructure()
    {
        this.AddStep(new Step1(), "Step 1: Health Check Execution");

        //Get Client Platform
        CL = GetClient();

        m = new HealthCheckManager(this, navigationsList, expectedMilestonesFile);
    }
Beispiel #3
0
        protected void Application_Start(object sender, EventArgs e)
        {
            _logger = LogManager.GetLogger(GetType());

            using (ILoggingOperation log = _logger.CriticalOperation())
            {
                log.Wrap(() =>
                {
                    ProbeManager.Init();
                    HealthCheckManager.Init();
                    ReportingManager.Init();
                    RemoteReportingManager.Init();
                });

                log.Wrap(() => ChannelsRabbitMQManager.Init());

                log.Wrap(() => Factory   = new StdSchedulerFactory());
                log.Wrap(() => Scheduler = Factory.GetScheduler());

                log.Wrap(() => Scheduler.Start());
            }
        }
 /// <summary>
 ///     Initializes a new instance of <see cref="HealthCheckController" />
 /// </summary>
 /// <param name="healthCheckDal">The health check dal</param>
 /// <param name="serverDal">The server dal</param>
 /// <param name="cloudProviderDal">The cloud provider dal</param>
 public HealthCheckController(IHealthCheckDal healthCheckDal, IServerDal serverDal,
                              ICloudProviderDal cloudProviderDal)
 {
     _healthCheckManager = new HealthCheckManager(healthCheckDal, serverDal, cloudProviderDal);
     _serverManager      = new ServerManager(serverDal, cloudProviderDal);
 }
Beispiel #5
0
 /// <summary>
 ///     Initializes a new instance of <see cref="ServerController" />
 /// </summary>
 /// <param name="serverDal">The server dal</param>
 /// <param name="cloudProviderDal">The cloud provider dal</param>
 /// <param name="healthCheckDal">The health check dal</param>
 public ServerController(IServerDal serverDal, ICloudProviderDal cloudProviderDal,
                         IHealthCheckDal healthCheckDal)
 {
     ServerManager      = new ServerManager(serverDal, cloudProviderDal);
     HealthCheckManager = new HealthCheckManager(healthCheckDal, serverDal, cloudProviderDal);
 }
Beispiel #6
0
        public IHttpActionResult TestDataLayer(int val1, int val2)
        {
            var returnThis = HealthCheckManager.AddThese(val1, val2);

            return(Ok(returnThis));
        }