internal ExchangeTopologyPerformanceCountersInstance(string instanceName, ExchangeTopologyPerformanceCountersInstance autoUpdateTotalInstance) : base(instanceName, "MSExchange Topology")
        {
            bool flag = false;
            List <ExPerformanceCounter> list = new List <ExPerformanceCounter>();

            try
            {
                this.LastExchangeTopologyDiscoveryTimeSeconds = new ExPerformanceCounter(base.CategoryName, "Latest Exchange Topology Discovery Time in Seconds", instanceName, true, null, new ExPerformanceCounter[0]);
                list.Add(this.LastExchangeTopologyDiscoveryTimeSeconds);
                this.ExchangeTopologyDiscoveriesPerformed = new ExPerformanceCounter(base.CategoryName, "Number of Exchange Topology Discoveries", instanceName, true, null, new ExPerformanceCounter[0]);
                list.Add(this.ExchangeTopologyDiscoveriesPerformed);
                this.SitelessServers = new ExPerformanceCounter(base.CategoryName, "Number of Siteless Servers", instanceName, true, null, new ExPerformanceCounter[0]);
                list.Add(this.SitelessServers);
                long num = this.LastExchangeTopologyDiscoveryTimeSeconds.RawValue;
                num += 1L;
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    foreach (ExPerformanceCounter exPerformanceCounter in list)
                    {
                        exPerformanceCounter.Close();
                    }
                }
            }
            this.counters = list.ToArray();
        }
예제 #2
0
        // Token: 0x06004F8A RID: 20362 RVA: 0x00125C74 File Offset: 0x00123E74
        private void CreateTopology()
        {
            bool flag  = ExchangeTopologyDiscovery.IncludeServices(this.topologyScope);
            bool flag2 = ExchangeTopologyDiscovery.IncludeADServers(this.topologyScope);
            Dictionary <string, ReadOnlyCollection <ADServer> > dictionary = null;

            if (flag2)
            {
                dictionary = new Dictionary <string, ReadOnlyCollection <ADServer> >(this.topoSites.Count);
                foreach (string key in this.siteADServerDictionary.Keys)
                {
                    dictionary.Add(key, new ReadOnlyCollection <ADServer>(this.siteADServerDictionary[key]));
                }
            }
            this.preparedTopology = new ExchangeTopology(this.discoveryStarted, this.topologyScope, new ReadOnlyCollection <TopologyServer>(this.topoServers), new ReadOnlyCollection <TopologySite>(this.topoSites), new ReadOnlyCollection <TopologySiteLink>(this.topoSiteLinks), flag ? new ReadOnlyCollection <MiniVirtualDirectory>(this.virtualDirectories) : null, flag ? new ReadOnlyCollection <MiniEmailTransport>(this.emailTransports) : null, flag ? new ReadOnlyCollection <MiniReceiveConnector>(this.smtpReceiveConnectors) : null, flag2 ? this.aDServers : null, flag2 ? this.aDServerSiteDictionary : null, dictionary, this.siteDictionary, this.localServerFqdn);
            TimeSpan timeSpan = this.preparedTopology.WhenCreated - this.discoveryStarted;

            ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, double>((long)this.GetHashCode(), "PFD ADPEXT {0} - It took {0} ms to create the Exchange topology", 20149, timeSpan.TotalMilliseconds);
            using (Process currentProcess = Process.GetCurrentProcess())
            {
                if (currentProcess != null)
                {
                    int num = 0;
                    foreach (TopologyServer topologyServer in this.topoServers)
                    {
                        if (topologyServer.TopologySite == null)
                        {
                            if (topologyServer.IsExchange2007OrLater)
                            {
                                num++;
                            }
                            else
                            {
                                ExTraceGlobals.ExchangeTopologyTracer.TraceDebug <string>(0L, "Server {0} belongs to no site because its version is Exchange 2003 or earlier.", topologyServer.Fqdn);
                            }
                        }
                    }
                    ExchangeTopologyPerformanceCountersInstance instance = ExchangeTopologyPerformanceCounters.GetInstance(currentProcess.Id.ToString());
                    instance.LastExchangeTopologyDiscoveryTimeSeconds.RawValue = (long)Math.Round(timeSpan.TotalSeconds);
                    instance.ExchangeTopologyDiscoveriesPerformed.Increment();
                    instance.SitelessServers.RawValue = (long)num;
                }
            }
        }