コード例 #1
0
        public JsonResult Get(HealthCheckTypes checkType = HealthCheckTypes.Shallow)
        {
            var man    = new SystemHealthManager();
            var status = man.PerformHealthCheck(checkType);

            return(Json(status));
        }
コード例 #2
0
        public HealthCheckStatus PerformHealthCheck(HealthCheckTypes checkType)
        {
            //switch type
            var status = new HealthCheckStatus();
            var p      = Process.GetCurrentProcess();

            status = new HealthCheckStatus
            {
                Threads         = p.Threads.Count,
                UptimeInMinutes = (DateTime.Now - p.StartTime).TotalMinutes,
                RamInMBytes     = (int)p.PeakWorkingSet64 / 1024 / 1024,
                Version         = Assembly.GetExecutingAssembly().GetName().Version.ToString(),
                Name            = "Email service on " + Environment.MachineName,
                IPAddress       = GetLocalIPAddress(),
                FreeDiskSpaceGb = FreeDiskSpaceGb(Path.GetPathRoot(Assembly.GetEntryAssembly().Location))
            };

            return(status);
        }