Beispiel #1
0
        public void RecalculateStatus(
            PerfCounterRangeModel cpuPerfCounterRangeModel, 
            PerfCounterRangeModel networkPerfCounterRangeModel, 
            PerfCounterRangeModel storagePerfCounterRangeModel)
        {
            if (SysStatus == VMStatus.NotFound)
            {
                Status = VMStatusColor.NotFoundKey;
                return;
            }

            var cpuStatus = cpuPerfCounterRangeModel.GetStatus(CPU);
            var networkStatus = networkPerfCounterRangeModel.GetStatus(Network);
            var storageStatus = storagePerfCounterRangeModel.GetStatus(Storage);

            if (SysStatus == VMStatus.Normal
                && cpuStatus == VMStatus.Normal
                && networkStatus == VMStatus.Normal
                && storageStatus == VMStatus.Normal)
            {
                Status = VMStatusColor.NormalKey;
            }
            else if (SysStatus == VMStatus.Warning
                     || cpuStatus == VMStatus.Warning
                     || networkStatus == VMStatus.Warning
                     || storageStatus == VMStatus.Warning)
            {
                Status = VMStatusColor.WarningKey;
            }
            else
            {
                Status = VMStatusColor.ErrorKey;
            }
        }
Beispiel #2
0
        public void RecalculateStatus(
            PerfCounterRangeModel cpuPerfCounterRangeModel,
            PerfCounterRangeModel networkPerfCounterRangeModel,
            PerfCounterRangeModel storagePerfCounterRangeModel)
        {
            if (SysStatus == VMStatus.NotFound)
            {
                Status = VMStatusColor.NotFoundKey;
                return;
            }

            var cpuStatus     = cpuPerfCounterRangeModel.GetStatus(CPU);
            var networkStatus = networkPerfCounterRangeModel.GetStatus(Network);
            var storageStatus = storagePerfCounterRangeModel.GetStatus(Storage);

            if (SysStatus == VMStatus.Normal &&
                cpuStatus == VMStatus.Normal &&
                networkStatus == VMStatus.Normal &&
                storageStatus == VMStatus.Normal)
            {
                Status = VMStatusColor.NormalKey;
            }
            else if (SysStatus == VMStatus.Warning ||
                     cpuStatus == VMStatus.Warning ||
                     networkStatus == VMStatus.Warning ||
                     storageStatus == VMStatus.Warning)
            {
                Status = VMStatusColor.WarningKey;
            }
            else
            {
                Status = VMStatusColor.ErrorKey;
            }
        }