protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            List <string> list          = new List <string>();
            StringBuilder stringBuilder = null;

            string[] instanceNames = MSExchangeTenantMonitoring.GetInstanceNames();
            if (instanceNames != null)
            {
                foreach (string text in instanceNames)
                {
                    if (!string.Equals("_total", text, StringComparison.OrdinalIgnoreCase) && this.CheckInstance(text))
                    {
                        MSExchangeTenantMonitoringInstance instance = MSExchangeTenantMonitoring.GetInstance(text);
                        double valueForCounter  = this.GetValueForCounter(instance, this.CounterNameForAttempts);
                        double valueForCounter2 = this.GetValueForCounter(instance, this.CounterNameForSuccesses);
                        if (valueForCounter != this.GetValueForCounter(instance, this.CounterNameForAttempts) || valueForCounter2 != this.GetValueForCounter(instance, this.CounterNameForSuccesses))
                        {
                            ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_IgnoringInstanceData, new string[]
                            {
                                text
                            });
                        }
                        else if (valueForCounter > 0.0 && valueForCounter >= this.MinimumCountForAlert && valueForCounter2 / valueForCounter * 100.0 < this.SuccessThresholdPercentage)
                        {
                            if (stringBuilder == null)
                            {
                                stringBuilder = new StringBuilder(text);
                            }
                            else if (list.Count < 10)
                            {
                                stringBuilder.AppendFormat(", {0}", text);
                            }
                            list.Add(text);
                            ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_InstanceAboveThreshold, new string[]
                            {
                                text,
                                valueForCounter.ToString(),
                                valueForCounter2.ToString()
                            });
                        }
                    }
                }
                if (list.Count > 0)
                {
                    stringBuilder.AppendFormat(", TotalFailingInstances={0}", list.Count);
                }
            }
            string text2 = (stringBuilder != null) ? stringBuilder.ToString() : string.Empty;

            if (!string.IsNullOrEmpty(text2))
            {
                if (TestTenantMonitoringPerfCounters.eventIdDictionary.ContainsKey(this.EventId))
                {
                    ExManagementApplicationLogger.LogEvent(TestTenantMonitoringPerfCounters.eventIdDictionary[this.EventId], new string[]
                    {
                        text2,
                        this.CounterNameForAttempts,
                        this.CounterNameForSuccesses,
                        this.MinimumCountForAlert.ToString(),
                        this.SuccessThresholdPercentage.ToString(),
                        this.GetFailureDetails(list, this.CounterNameForAttempts)
                    });
                }
            }
            else
            {
                ExManagementApplicationLogger.LogEvent(ManagementEventLogConstants.Tuple_TenantMonitoringSuccess, new string[]
                {
                    this.CounterNameForAttempts,
                    this.CounterNameForSuccesses
                });
            }
            base.InternalProcessRecord();
            TaskLogger.LogExit();
        }
        private double GetValueForCounter(MSExchangeTenantMonitoringInstance instance, string counterName)
        {
            double result = 0.0;

            switch (counterName)
            {
            case "MSExchangeCmdletIterationSuccesses":
                result = (double)instance.MSExchangeCmdletIterationSuccesses.RawValue;
                break;

            case "MSExchangeCmdletIterationAttempts":
                result = (double)instance.MSExchangeCmdletIterationAttempts.RawValue;
                break;

            case "MSExchangeCmdletSuccesses":
                result = (double)instance.MSExchangeCmdletSuccesses.RawValue;
                break;

            case "MSExchangeCmdletAttempts":
                result = (double)instance.MSExchangeCmdletAttempts.RawValue;
                break;

            case "MSExchangeGetManagementEndpointIterationSuccesses":
                result = (double)instance.MSExchangeGetManagementEndpointIterationSuccesses.RawValue;
                break;

            case "MSExchangeGetManagementEndpointIterationAttempts":
                result = (double)instance.MSExchangeGetManagementEndpointIterationAttempts.RawValue;
                break;

            case "MSExchangeGetManagementEndpointSuccesses":
                result = (double)instance.MSExchangeGetManagementEndpointSuccesses.RawValue;
                break;

            case "MSExchangeGetManagementEndpointAttempts":
                result = (double)instance.MSExchangeGetManagementEndpointAttempts.RawValue;
                break;

            case "MSExchangeRemoveSecondaryDomainIterationSuccesses":
                result = (double)instance.MSExchangeRemoveSecondaryDomainIterationSuccesses.RawValue;
                break;

            case "MSExchangeRemoveSecondaryDomainIterationAttempts":
                result = (double)instance.MSExchangeRemoveSecondaryDomainIterationAttempts.RawValue;
                break;

            case "MSExchangeRemoveSecondaryDomainSuccesses":
                result = (double)instance.MSExchangeRemoveSecondaryDomainSuccesses.RawValue;
                break;

            case "MSExchangeRemoveSecondaryDomainAttempts":
                result = (double)instance.MSExchangeRemoveSecondaryDomainAttempts.RawValue;
                break;

            case "MSExchangeAddSecondaryDomainIterationSuccesses":
                result = (double)instance.MSExchangeAddSecondaryDomainIterationSuccesses.RawValue;
                break;

            case "MSExchangeAddSecondaryDomainIterationAttempts":
                result = (double)instance.MSExchangeAddSecondaryDomainIterationAttempts.RawValue;
                break;

            case "MSExchangeAddSecondaryDomainSuccesses":
                result = (double)instance.MSExchangeAddSecondaryDomainSuccesses.RawValue;
                break;

            case "MSExchangeAddSecondaryDomainAttempts":
                result = (double)instance.MSExchangeAddSecondaryDomainAttempts.RawValue;
                break;

            case "MSExchangeRemoveOrganizationIterationSuccesses":
                result = (double)instance.MSExchangeRemoveOrganizationIterationSuccesses.RawValue;
                break;

            case "MSExchangeRemoveOrganizationIterationAttempts":
                result = (double)instance.MSExchangeRemoveOrganizationIterationAttempts.RawValue;
                break;

            case "MSExchangeRemoveOrganizationSuccesses":
                result = (double)instance.MSExchangeRemoveOrganizationSuccesses.RawValue;
                break;

            case "MSExchangeRemoveOrganizationAttempts":
                result = (double)instance.MSExchangeRemoveOrganizationAttempts.RawValue;
                break;

            case "MSExchangeNewOrganizationIterationSuccesses":
                result = (double)instance.MSExchangeNewOrganizationIterationSuccesses.RawValue;
                break;

            case "MSExchangeNewOrganizationIterationAttempts":
                result = (double)instance.MSExchangeNewOrganizationIterationAttempts.RawValue;
                break;

            case "MSExchangeNewOrganizationSuccesses":
                result = (double)instance.MSExchangeNewOrganizationSuccesses.RawValue;
                break;

            case "MSExchangeNewOrganizationAttempts":
                result = (double)instance.MSExchangeNewOrganizationAttempts.RawValue;
                break;

            case "MSExchangeNewMailboxIterationSuccesses":
                result = (double)instance.MSExchangeNewMailboxIterationSuccesses.RawValue;
                break;

            case "MSExchangeNewMailboxIterationAttempts":
                result = (double)instance.MSExchangeNewMailboxIterationAttempts.RawValue;
                break;

            case "MSExchangeNewMailboxSuccesses":
                result = (double)instance.MSExchangeNewMailboxSuccesses.RawValue;
                break;

            case "MSExchangeNewMailboxAttempts":
                result = (double)instance.MSExchangeNewMailboxAttempts.RawValue;
                break;
            }
            return(result);
        }