示例#1
0
        public HealthResult CheckHealth(bool intrusive = false)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();

            IEnumerable <SystemCheckResult> systemCheckResults = systemStateCheckers
                                                                 .Select(checker => CheckSystemState(intrusive, checker))
                                                                 .Select(checkTask => checkTask.Result).ToArray();

            var result = new HealthResult
            {
                CheckupDate   = DateTime.UtcNow,
                Health        = GetOverallHealth(systemCheckResults),
                SystemStates  = systemCheckResults,
                SystemVersion = versionProvider.GetSystemVersion(),
                Host          = Environment.MachineName
            };

            stopwatch.Stop();

            result.TimeTaken = stopwatch.Elapsed;

            return(result);
        }