Exemple #1
0
        protected override XElement GetDiagnosticInfoInternal(MRSDiagnosticArgument arguments)
        {
            this.InitializeMonitors();
            ResourceDiagnosticInfoXML resourceDiagnosticInfoXML = new ResourceDiagnosticInfoXML
            {
                ResourceName       = this.ResourceName,
                ResourceGuid       = this.ResourceGuid,
                ResourceType       = this.ResourceType,
                StaticCapacity     = this.StaticCapacity,
                DynamicCapacity    = this.DynamicCapacity,
                Utilization        = base.Utilization,
                IsUnhealthy        = this.IsUnhealthy,
                WlmWorkloadType    = this.WlmWorkloadType.ToString(),
                TransferRatePerMin = this.TransferRate.GetValue()
            };

            if (this.healthMonitors.Count > 0)
            {
                resourceDiagnosticInfoXML.WlmResourceHealthMonitors = new List <WlmResourceHealthMonitorDiagnosticInfoXML>();
                foreach (WlmResourceHealthMonitor wlmResourceHealthMonitor in this.healthMonitors)
                {
                    WlmResourceHealthMonitorDiagnosticInfoXML wlmResourceHealthMonitorDiagnosticInfoXML = wlmResourceHealthMonitor.PopulateDiagnosticInfo(arguments);
                    if (wlmResourceHealthMonitorDiagnosticInfoXML != null)
                    {
                        resourceDiagnosticInfoXML.WlmResourceHealthMonitors.Add(wlmResourceHealthMonitorDiagnosticInfoXML);
                    }
                }
            }
            return(resourceDiagnosticInfoXML.ToDiagnosticInfo(null));
        }
Exemple #2
0
        public WlmResourceHealthMonitorDiagnosticInfoXML PopulateDiagnosticInfo(MRSDiagnosticArgument arguments)
        {
            if (arguments.HasArgument("unhealthy") && !this.IsUnhealthy)
            {
                return(null);
            }
            ResourceLoad currentLoad = this.GetCurrentLoad();
            WlmResourceHealthMonitorDiagnosticInfoXML wlmResourceHealthMonitorDiagnosticInfoXML = new WlmResourceHealthMonitorDiagnosticInfoXML
            {
                WlmResourceKey           = this.WlmResourceKey.ToString(),
                DynamicCapacity          = (double)this.DynamicCapacity,
                LoadState                = currentLoad.State.ToString(),
                LoadRatio                = currentLoad.LoadRatio,
                Metric                   = ((currentLoad.Metric != null) ? currentLoad.Metric.ToString() : string.Empty),
                IsDisabled               = (this.IsDisabled ? "true" : null),
                DynamicThrottingDisabled = (this.DynamicThrottlingDisabled ? "true" : null)
            };

            if (arguments.HasArgument("healthstats"))
            {
                wlmResourceHealthMonitorDiagnosticInfoXML.WlmHealthStatistics = this.healthTracker.GetStats();
            }
            return(wlmResourceHealthMonitorDiagnosticInfoXML);
        }