コード例 #1
0
 protected override void InternalProcessRecord()
 {
     TaskLogger.LogEnter();
     if (base.HasErrors)
     {
         TaskLogger.LogExit();
         return;
     }
     ReplicationCheckGlobals.WriteVerboseDelegate = new Task.TaskVerboseLoggingDelegate(base.WriteVerbose);
     try
     {
         base.WriteVerbose(Strings.StartingToRunChecks(this.m_serverName));
         this.RunChecks();
         if (this.MonitoringContext && !this.m_eventManager.HasMomEvents())
         {
             base.WriteVerbose(Strings.NoMonitoringErrorsInTestReplicationHealth(this.m_serverName));
             this.m_eventManager.LogEvent(10000, Strings.NoMonitoringErrorsInTestReplicationHealth(this.m_serverName));
         }
     }
     finally
     {
         if (this.MonitoringContext)
         {
             this.WriteMonitoringData();
         }
         ReplicationCheckGlobals.ResetState();
         TaskLogger.LogExit();
     }
 }
コード例 #2
0
        protected override void InternalRun()
        {
            if (!ReplicationCheckGlobals.ThirdPartyReplCheckHasRun)
            {
                ReplicationCheckGlobals.ThirdPartyReplCheckHasRun = true;
            }
            else
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "ThirdPartyReplCheck skipping because it has already been run once.");
                base.Skip();
            }
            if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ReplayServiceCheck))))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayServiceCheck didn't pass! Skipping {0}.", base.Title);
                base.Skip();
            }
            if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped)
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title);
                base.Skip();
            }
            string    error = null;
            bool      flag  = false;
            Exception ex    = null;

            try
            {
                if (AmRpcVersionControl.IsCheckThirdPartyListenerSupported(ReplicationCheckGlobals.Server.AdminDisplayVersion))
                {
                    if (ReplicationCheckGlobals.WriteVerboseDelegate != null)
                    {
                        ReplicationCheckGlobals.WriteVerboseDelegate(Strings.TestRHCheckTPRListener(ReplicationCheckGlobals.Server.AdminDisplayVersion.ToString(), AmRpcVersionControl.ThirdPartyReplListenerSupportedVersion.ToString()));
                    }
                    flag = AmRpcClientHelper.CheckThirdPartyListener(base.ServerName, out error);
                }
                else
                {
                    ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ThirdPartyReplCheck skipping because server {0} doesn't support the CheckThirdPartyListener RPC.", base.ServerName);
                    base.Skip();
                }
            }
            catch (AmServerException ex2)
            {
                ex = ex2;
            }
            catch (AmServerTransientException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                base.Fail(Strings.ErrorCheckingTPRListener(base.ServerName, ex.Message));
            }
            ExTraceGlobals.HealthChecksTracer.TraceDebug <string, bool>((long)this.GetHashCode(), "TPR is healthy on server {0}: {1}", base.ServerName, flag);
            if (!flag)
            {
                base.Fail(Strings.TPRListenerNotHealthy(base.ServerName, error));
            }
        }
コード例 #3
0
        private Dictionary <Guid, RpcDatabaseCopyStatus2> GetCopyStatusRpcResults()
        {
            Dictionary <Guid, RpcDatabaseCopyStatus2> result = null;
            ServerVersion adminDisplayVersion = ReplicationCheckGlobals.Server.AdminDisplayVersion;

            if (ReplicationCheckGlobals.WriteVerboseDelegate != null)
            {
                ReplicationCheckGlobals.WriteVerboseDelegate(Strings.TestRHUseCopyStatusRpc(adminDisplayVersion.ToString(), ReplayRpcVersionControl.GetCopyStatusEx2SupportVersion.ToString()));
            }
            RpcDatabaseCopyStatus2[] copyStatus = ReplayRpcClientHelper.GetCopyStatus(base.ServerName, ReplicationCheckGlobals.RunningInMonitoringContext ? RpcGetDatabaseCopyStatusFlags2.None : RpcGetDatabaseCopyStatusFlags2.ReadThrough, null);
            if (copyStatus != null && copyStatus.Length > 0)
            {
                result = ReplayRpcClientHelper.ParseStatusResults(copyStatus);
                if (ReplicationCheckGlobals.WriteVerboseDelegate != null)
                {
                    ReplicationCheckGlobals.WriteVerboseDelegate(Strings.TestRHRpcQueryAllDone(copyStatus.Length));
                }
            }
            return(result);
        }
コード例 #4
0
 protected override void InternalValidate()
 {
     TaskLogger.LogEnter();
     try
     {
         this.ConfigurationSession.ServerTimeout             = new TimeSpan?(TimeSpan.FromSeconds((double)this.ActiveDirectoryTimeout));
         ((IDirectorySession)base.DataSession).ServerTimeout = new TimeSpan?(TimeSpan.FromSeconds((double)this.ActiveDirectoryTimeout));
         if (this.Identity == null)
         {
             this.m_serverName = Environment.MachineName;
             this.Identity     = ServerIdParameter.Parse(this.m_serverName);
         }
         base.InternalValidate();
         if (base.HasErrors)
         {
             TaskLogger.LogExit();
         }
         else
         {
             ADServerWrapper server = ADObjectWrapperFactory.CreateWrapper(this.DataObject);
             ReplicationCheckGlobals.Server = server;
             this.m_serverName = this.DataObject.Name;
             ExTraceGlobals.CmdletsTracer.TraceDebug <string>((long)this.GetHashCode(), "serverName is '{0}'.", this.m_serverName ?? "null");
             this.m_isLocal = SharedHelper.StringIEquals(this.m_serverName, Environment.MachineName);
             if (!this.m_isLocal && this.MonitoringContext)
             {
                 this.WriteErrorAndMonitoringEvent(new CannotRunMonitoringTaskRemotelyException(this.m_serverName), ErrorCategory.InvalidOperation, this.Identity, 10011, "MSExchange Monitoring ReplicationHealth");
             }
             ReplicationCheckGlobals.RunningInMonitoringContext = this.MonitoringContext;
             if (this.m_isLocal && !this.CheckLocalServerRegistryRoles())
             {
                 ExTraceGlobals.CmdletsTracer.TraceDebug((long)this.GetHashCode(), "Local server does not have Exchange 2009 Mailbox Role in the registry.");
             }
             else
             {
                 this.CheckServerObject();
                 if (this.DataObject.DatabaseAvailabilityGroup != null)
                 {
                     this.m_serverConfigBitfield |= ServerConfig.DagMember;
                     this.m_dag = this.ConfigurationSession.Read <DatabaseAvailabilityGroup>(this.DataObject.DatabaseAvailabilityGroup);
                     if (this.m_dag.StoppedMailboxServers.Contains(new AmServerName(this.m_serverName).Fqdn))
                     {
                         this.m_serverConfigBitfield |= ServerConfig.Stopped;
                     }
                 }
                 else
                 {
                     ExTraceGlobals.CmdletsTracer.TraceDebug <string>((long)this.GetHashCode(), "{0} is a Standalone non-DAG Mailbox server.", this.DataObject.Name);
                 }
                 try
                 {
                     this.BuildReplayConfigurations(this.m_dag, server);
                 }
                 catch (ClusterException exception)
                 {
                     this.WriteErrorAndMonitoringEvent(exception, ErrorCategory.InvalidOperation, null, 10003, "MSExchange Monitoring ReplicationHealth");
                     return;
                 }
                 catch (TransientException exception2)
                 {
                     this.WriteErrorAndMonitoringEvent(exception2, ErrorCategory.InvalidOperation, null, 10003, "MSExchange Monitoring ReplicationHealth");
                     return;
                 }
                 catch (DataSourceOperationException exception3)
                 {
                     this.WriteErrorAndMonitoringEvent(exception3, ErrorCategory.InvalidOperation, null, 10003, "MSExchange Monitoring ReplicationHealth");
                     return;
                 }
                 catch (DataValidationException exception4)
                 {
                     this.WriteErrorAndMonitoringEvent(exception4, ErrorCategory.InvalidData, null, 10003, "MSExchange Monitoring ReplicationHealth");
                     return;
                 }
                 ReplicationCheckGlobals.ServerConfiguration = this.m_serverConfigBitfield;
                 if (this.DataObject != null)
                 {
                     this.m_useReplayRpc = ReplayRpcVersionControl.IsGetCopyStatusEx2RpcSupported(this.DataObject.AdminDisplayVersion);
                 }
                 this.CheckIfTaskCanRun();
             }
         }
     }
     finally
     {
         if (base.HasErrors)
         {
             if (this.MonitoringContext)
             {
                 this.WriteMonitoringData();
             }
             ReplicationCheckGlobals.ResetState();
         }
         TaskLogger.LogExit();
     }
 }
コード例 #5
0
 protected override void InternalStateReset()
 {
     base.InternalStateReset();
     this.ResetPrivateState();
     ReplicationCheckGlobals.ResetState();
 }
コード例 #6
0
        protected override void InternalRun()
        {
            if (!ReplicationCheckGlobals.ActiveManagerCheckHasRun)
            {
                ReplicationCheckGlobals.ActiveManagerCheckHasRun = true;
            }
            else
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "ActiveManagerCheck skipping because it has already been run once.");
                base.Skip();
            }
            if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ReplayServiceCheck))))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayServiceCheck didn't pass! Skipping {0}.", base.Title);
                base.Skip();
            }
            if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped)
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title);
                base.Skip();
            }
            string error  = null;
            AmRole amRole = AmRole.Unknown;

            try
            {
                if (AmRpcVersionControl.IsGetAmRoleRpcSupported(ReplicationCheckGlobals.Server.AdminDisplayVersion))
                {
                    if (ReplicationCheckGlobals.WriteVerboseDelegate != null)
                    {
                        ReplicationCheckGlobals.WriteVerboseDelegate(Strings.TestRHGetAmRoleRpc(ReplicationCheckGlobals.Server.AdminDisplayVersion.ToString(), AmRpcVersionControl.GetAMRoleSupportVersion.ToString()));
                    }
                    amRole = AmRpcClientHelper.GetActiveManagerRole(base.ServerName, out error);
                    ReplicationCheckGlobals.ActiveManagerRole = amRole;
                }
                else
                {
                    ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ActiveManagerCheck skipping because server {0} doesn't support the GetActiveManagerRole RPC.", base.ServerName);
                    base.Skip();
                }
            }
            catch (AmServerException ex)
            {
                base.Fail(Strings.ErrorReadingAMRole(base.ServerName, ex.Message));
            }
            catch (AmServerTransientException ex2)
            {
                base.Fail(Strings.ErrorReadingAMRole(base.ServerName, ex2.Message));
            }
            ExTraceGlobals.HealthChecksTracer.TraceDebug <AmRole, string>((long)this.GetHashCode(), "AM has role {0} on server {1}.", amRole, base.ServerName);
            if (amRole == AmRole.Unknown)
            {
                base.Fail(Strings.AmUnknownRole(base.ServerName, error));
            }
            if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.DagMember) == ServerConfig.DagMember)
            {
                if (amRole == AmRole.Standalone)
                {
                    base.Fail(Strings.AmInvalidRoleDagServer(base.ServerName));
                    return;
                }
            }
            else if (amRole != AmRole.Standalone)
            {
                base.Fail(Strings.AmInvalidRoleStandaloneServer(base.ServerName));
            }
        }