예제 #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));
        }
예제 #2
0
        public static XElement GetJobsDiagnosticInfo(MRSDiagnosticArgument arguments)
        {
            int    num      = arguments.GetArgumentOrDefault <int>("maxsize", int.MaxValue);
            Guid   empty    = Guid.Empty;
            string text     = null;
            string argument = arguments.GetArgument <string>("job");

            if (!string.IsNullOrEmpty(argument) && !Guid.TryParse(argument, out empty))
            {
                text = argument;
            }
            MRSRequestType?argumentOrDefault = arguments.GetArgumentOrDefault <MRSRequestType?>("requesttype", null);
            XElement       xelement          = new XElement("Jobs");

            lock (MailboxSyncerJobs.syncRoot)
            {
                using (Dictionary <Guid, BaseJob> .ValueCollection.Enumerator enumerator = MailboxSyncerJobs.activeJobs.Values.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        BaseJob baseJob = enumerator.Current;
                        if (num == 0)
                        {
                            break;
                        }
                        if ((empty == Guid.Empty || empty == baseJob.RequestJobGuid) && (argumentOrDefault == null || argumentOrDefault == baseJob.CachedRequestJob.RequestType) && (string.IsNullOrEmpty(text) || CommonUtils.IsValueInWildcardedList(baseJob.RequestJobStoringMDB.ToString(), text)))
                        {
                            xelement.Add(arguments.RunDiagnosticOperation(() => baseJob.GetJobDiagnosticInfo(arguments)));
                            num--;
                        }
                    }
                }
            }
            return(xelement);
        }
예제 #3
0
        private XElement GetQueueDiagnosticInfo(MRSDiagnosticArgument arguments)
        {
            DatabaseInformation databaseInformation = MapiUtils.FindServerForMdb(this.MdbGuid, null, null, FindServerFlags.AllowMissing);
            string argument = arguments.GetArgument <string>("queues");

            if (!string.IsNullOrEmpty(argument) && (databaseInformation.IsMissing || !CommonUtils.IsValueInWildcardedList(databaseInformation.DatabaseName, argument)))
            {
                return(null);
            }
            MRSQueueDiagnosticInfoXML mrsqueueDiagnosticInfoXML = new MRSQueueDiagnosticInfoXML
            {
                MdbGuid                  = this.MdbGuid,
                MdbName                  = databaseInformation.DatabaseName,
                LastJobPickup            = this.LastJobPickup,
                LastInteractiveJobPickup = this.LastInteractiveJobPickup,
                QueuedJobsCount          = this.QueuedJobsCount,
                InProgressJobsCount      = this.InProgressJobsCount,
                LastScanFailure          = this.LastScanFailure,
                MdbDiscoveryTimestamp    = this.MdbDiscoveryTimestamp,
                LastScanTimestamp        = this.LastScanTimestamp,
                LastScanDurationMs       = (int)this.LastScanDuration.TotalMilliseconds,
                NextRecommendedScan      = this.NextRecommendedScan,
                LastActiveJobFinishTime  = this.LastActiveJobFinishTime,
                LastActiveJobFinished    = this.LastActiveJobFinished
            };

            if (arguments.HasArgument("pickupresults"))
            {
                mrsqueueDiagnosticInfoXML.LastScanResults = this.LastScanResults;
            }
            return(mrsqueueDiagnosticInfoXML.ToDiagnosticInfo(null));
        }
예제 #4
0
        public XElement GetDiagnosticInfo(MRSDiagnosticArgument arguments)
        {
            XElement xelement = new XElement("Reservation");

            this.GetDiagnosticInfoInternal(xelement);
            return(xelement);
        }
예제 #5
0
        public XElement GetDiagnosticInfo(MRSDiagnosticArgument arguments)
        {
            string argument = arguments.GetArgument <string>("resources");

            if (!string.IsNullOrEmpty(argument) && !CommonUtils.IsValueInWildcardedList(this.ResourceName, argument) && !CommonUtils.IsValueInWildcardedList(this.ResourceType, argument))
            {
                return(null);
            }
            if (arguments.HasArgument("unhealthy") && !this.IsUnhealthy)
            {
                return(null);
            }
            return(this.GetDiagnosticInfoInternal(arguments));
        }
예제 #6
0
        public static XElement GetReservationsDiagnosticInfo(MRSDiagnosticArgument arguments)
        {
            XElement xelement = new XElement("Reservations");

            lock (ReservationManager.Locker)
            {
                using (List <ReservationBase> .Enumerator enumerator = ReservationManager.reservations.Values.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        ReservationBase reservation = enumerator.Current;
                        xelement.Add(arguments.RunDiagnosticOperation(() => reservation.GetDiagnosticInfo(arguments)));
                    }
                }
            }
            return(xelement);
        }
예제 #7
0
        public static XElement GetDiagnosticInfo(MRSDiagnosticArgument arguments)
        {
            XElement xelement = new XElement("Queues");

            lock (MRSQueue.locker)
            {
                using (List <MRSQueue> .Enumerator enumerator = MRSQueue.queues.Values.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        MRSQueue queue = enumerator.Current;
                        xelement.Add(arguments.RunDiagnosticOperation(() => queue.GetQueueDiagnosticInfo(arguments)));
                    }
                }
            }
            return(xelement);
        }
예제 #8
0
        public static XElement GetResourcesDiagnosticInfo(MRSDiagnosticArgument arguments)
        {
            XElement root = new XElement("Resources");

            lock (ReservationManager.Locker)
            {
                MRSResource.Cache.ForEach(delegate(MRSResource m)
                {
                    root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments)));
                });
                LocalServerReadResource.Cache.ForEach(delegate(LocalServerReadResource m)
                {
                    root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments)));
                });
                LocalServerWriteResource.Cache.ForEach(delegate(LocalServerWriteResource m)
                {
                    root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments)));
                });
                DatabaseReadResource.Cache.ForEach(delegate(DatabaseReadResource m)
                {
                    root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments)));
                });
                DatabaseWriteResource.Cache.ForEach(delegate(DatabaseWriteResource m)
                {
                    root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments)));
                });
                MailboxMoveSourceResource.Cache.ForEach(delegate(MailboxMoveSourceResource m)
                {
                    root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments)));
                });
                MailboxMoveTargetResource.Cache.ForEach(delegate(MailboxMoveTargetResource m)
                {
                    root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments)));
                });
                MailboxMergeSourceResource.Cache.ForEach(delegate(MailboxMergeSourceResource m)
                {
                    root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments)));
                });
                MailboxMergeTargetResource.Cache.ForEach(delegate(MailboxMergeTargetResource m)
                {
                    root.Add(arguments.RunDiagnosticOperation(() => m.GetDiagnosticInfo(arguments)));
                });
            }
            return(root);
        }
예제 #9
0
        protected virtual XElement GetDiagnosticInfoInternal(MRSDiagnosticArgument arguments)
        {
            XElement result;

            lock (this.Locker)
            {
                XElement xelement = new XElement("Resource", new object[]
                {
                    new XAttribute("Type", this.ResourceType),
                    new XAttribute("Name", this.ResourceName),
                    new XAttribute("Utilization", this.Utilization)
                });
                foreach (ReservationBase reservationBase in this.Reservations.Values)
                {
                    xelement.Add(new XElement("Client", reservationBase.ClientName));
                }
                result = xelement;
            }
            return(result);
        }
예제 #10
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);
        }
        internal TransferProgressTrackerXML GetDiagnosticInfo(MRSDiagnosticArgument arguments)
        {
            bool showTimeSlots = arguments.HasArgument("showtimeslots");

            return(new TransferProgressTrackerXML(this, showTimeSlots));
        }
예제 #12
0
        XElement IDiagnosable.GetDiagnosticInfo(DiagnosableParameters parameters)
        {
            XElement xelement = new XElement(MRSService.DiagnosticsComponentName);
            MRSDiagnosticArgument arguments;

            try
            {
                arguments = new MRSDiagnosticArgument(parameters.Argument);
            }
            catch (DiagnosticArgumentException ex)
            {
                xelement.Add(new XElement("Error", "Encountered exception: " + ex.Message));
                return(xelement);
            }
            xelement.Add(new object[]
            {
                new XElement("ServiceStartTime", MRSService.serviceStartTime),
                new XElement("LastScanDuration", MRSService.lastFullScanDuration),
                new XElement("LastScanTime", MRSService.lastFullScanTime.ToString()),
                new XElement("DurationSinceLastScan", (long)(DateTime.UtcNow - MRSService.lastFullScanTime).TotalMilliseconds),
                new XElement("NextFullScanTime", MRSService.NextFullScanTime.ToString()),
                new XElement("NextLightJobsFullScanTime", MRSService.nextLightJobsFullScanTime.ToString())
            });
            if (arguments.ArgumentCount == 0)
            {
                xelement.Add(new XElement("Help", "Supported arguments: " + arguments.GetSupportedArguments()));
            }
            if (arguments.HasArgument("binaryversions"))
            {
                string assemblyNamePattern = arguments.GetArgument <string>("binaryversions");
                xelement.Add(arguments.RunDiagnosticOperation(() => CommonUtils.GetBinaryVersions(assemblyNamePattern)));
            }
            if (arguments.HasArgument("job"))
            {
                xelement.Add(arguments.RunDiagnosticOperation(() => MailboxSyncerJobs.GetJobsDiagnosticInfo(arguments)));
            }
            if (arguments.HasArgument("reservations"))
            {
                xelement.Add(arguments.RunDiagnosticOperation(() => ReservationManager.GetReservationsDiagnosticInfo(arguments)));
            }
            if (arguments.HasArgument("resources"))
            {
                xelement.Add(arguments.RunDiagnosticOperation(() => ReservationManager.GetResourcesDiagnosticInfo(arguments)));
            }
            if (arguments.HasArgument("queues"))
            {
                xelement.Add(arguments.RunDiagnosticOperation(() => MRSQueue.GetDiagnosticInfo(arguments)));
            }
            if (arguments.HasArgument("workloads"))
            {
                XElement xelement2 = new XElement("Workloads");
                foreach (object obj in Enum.GetValues(typeof(RequestWorkloadType)))
                {
                    RequestWorkloadType requestWorkloadType = (RequestWorkloadType)obj;
                    if (requestWorkloadType != RequestWorkloadType.None)
                    {
                        GenericSettingsContext genericSettingsContext = new GenericSettingsContext("RequestWorkloadType", requestWorkloadType.ToString(), null);
                        using (genericSettingsContext.Activate())
                        {
                            bool config = ConfigBase <MRSConfigSchema> .GetConfig <bool>("IsJobPickupEnabled");

                            xelement2.Add(new XElement("Workload", new object[]
                            {
                                new XAttribute("Name", requestWorkloadType.ToString()),
                                new XAttribute("IsJobPickupEnabled", config)
                            }));
                        }
                    }
                }
                xelement.Add(xelement2);
            }
            return(xelement);
        }