Exemple #1
0
        private static int CalculateOutgoingReplicationHealth(ADMetrics newMetrics, int traceKey)
        {
            int             num             = 100;
            ADServerMetrics adserverMetrics = null;

            using (IEnumerator <ADServerMetrics> enumerator = newMetrics.AllServerMetrics.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ADServerMetrics dcMetrics = enumerator.Current;
                    if (dcMetrics.IsSuitable && dcMetrics.InjectionRate >= 0.0)
                    {
                        foreach (ADServerMetrics adserverMetrics2 in newMetrics.AllServerMetrics)
                        {
                            if (adserverMetrics2.IsSuitable && adserverMetrics2.InjectionRate >= 0.0)
                            {
                                long?num2 = null;
                                foreach (ICollection <ADReplicationLinkMetrics> source in new ICollection <ADReplicationLinkMetrics>[]
                                {
                                    adserverMetrics2.ConfigReplicationMetrics,
                                    adserverMetrics2.DomainReplicationMetrics
                                })
                                {
                                    ADReplicationLinkMetrics adreplicationLinkMetrics = source.FirstOrDefault((ADReplicationLinkMetrics linkMetrics) => linkMetrics.NeighborDnsHostName.Equals(dcMetrics.DnsHostName, StringComparison.OrdinalIgnoreCase));
                                    if (adreplicationLinkMetrics != null && (num2 == null || num2.Value > dcMetrics.HighestUsn - adreplicationLinkMetrics.UpToDatenessUsn))
                                    {
                                        num2 = new long?(dcMetrics.HighestUsn - adreplicationLinkMetrics.UpToDatenessUsn);
                                    }
                                }
                                dcMetrics.OutgoingDebt = (num2 ?? 0L);
                                ExTraceGlobals.ResourceHealthManagerTracer.TraceDebug <string, long>((long)traceKey, "[ADResourceHealthMonitor::CalculateOutgoingReplicationHealth] {0}: OutgoingDebt={1}.", dcMetrics.DnsHostName, dcMetrics.OutgoingDebt);
                                dcMetrics.OutgoingHealth = ADResourceHealthMonitor.CalculateReplicationHealthMeasure((double)dcMetrics.OutgoingDebt, adserverMetrics2.InjectionRate, traceKey);
                                ExTraceGlobals.ResourceHealthManagerTracer.TraceDebug <string, int>((long)traceKey, "[ADResourceHealthMonitor::CalculateOutgoingReplicationHealth] {0}: OutgoingHealthMeasure={1}.", dcMetrics.DnsHostName, dcMetrics.OutgoingHealth);
                                if (dcMetrics.OutgoingHealth < num || adserverMetrics == null)
                                {
                                    num             = dcMetrics.OutgoingHealth;
                                    adserverMetrics = dcMetrics;
                                }
                            }
                        }
                    }
                }
            }
            ExTraceGlobals.ResourceHealthManagerTracer.TraceDebug <int, string>((long)traceKey, "[ADResourceHealthMonitor::CalculateOutgoingReplicationHealth] Min OutgoingHealthMeasure={0} on DC {1}.", num, (adserverMetrics != null) ? adserverMetrics.DnsHostName : "<none>");
            newMetrics.OutgoingHealth = num;
            if (num < 100)
            {
                newMetrics.MinOutgoingHealthServer = adserverMetrics.DnsHostName;
            }
            return(num);
        }
Exemple #2
0
        private static TimeSpan CalculateOutgoingReplicationLatency(ADMetrics newMetrics, int traceKey)
        {
            TimeSpan        timeSpan        = TimeSpan.Zero;
            ADServerMetrics adserverMetrics = null;

            using (IEnumerator <ADServerMetrics> enumerator = newMetrics.AllServerMetrics.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ADServerMetrics dcMetrics = enumerator.Current;
                    if (dcMetrics.IsSuitable && dcMetrics.InjectionRate >= 0.0)
                    {
                        foreach (ADServerMetrics adserverMetrics2 in newMetrics.AllServerMetrics)
                        {
                            if (adserverMetrics2.IsSuitable && adserverMetrics2.InjectionRate >= 0.0)
                            {
                                long num = 0L;
                                foreach (ICollection <ADReplicationLinkMetrics> source in new ICollection <ADReplicationLinkMetrics>[]
                                {
                                    adserverMetrics2.ConfigReplicationMetrics,
                                    adserverMetrics2.DomainReplicationMetrics
                                })
                                {
                                    ADReplicationLinkMetrics adreplicationLinkMetrics = source.FirstOrDefault((ADReplicationLinkMetrics linkMetrics) => linkMetrics.NeighborDnsHostName.Equals(dcMetrics.DnsHostName, StringComparison.OrdinalIgnoreCase));
                                    if (adreplicationLinkMetrics != null)
                                    {
                                        num += dcMetrics.HighestUsn - adreplicationLinkMetrics.UpToDatenessUsn;
                                    }
                                }
                                ExTraceGlobals.ResourceHealthManagerTracer.TraceDebug <string, long>((long)traceKey, "[ADResourceHealthMonitor::CalculateOutgoingReplicationLatency] {0}: OutgoingDebt={1}.", dcMetrics.DnsHostName, num);
                                dcMetrics.OutgoingDebt = num;
                                TimeSpan timeSpan2 = ADResourceHealthMonitor.CalculateReplicationLatency((double)num, adserverMetrics2.InjectionRate, traceKey);
                                ExTraceGlobals.ResourceHealthManagerTracer.TraceDebug <string, TimeSpan>((long)traceKey, "[ADResourceHealthMonitor::CalculateOutgoingReplicationLatency] {0}: replicationLatency={1}.", dcMetrics.DnsHostName, timeSpan2);
                                if (timeSpan2 > timeSpan || adserverMetrics == null)
                                {
                                    timeSpan        = timeSpan2;
                                    adserverMetrics = dcMetrics;
                                }
                            }
                        }
                    }
                }
            }
            ExTraceGlobals.ResourceHealthManagerTracer.TraceDebug <TimeSpan, string>((long)traceKey, "[ADResourceHealthMonitor::CalculateOutgoingReplicationLatency] Min OutgoingHealthMeasure={0} on DC {1}.", timeSpan, (adserverMetrics != null) ? adserverMetrics.DnsHostName : "<none>");
            return(timeSpan);
        }