Exemple #1
0
 public void RaiseAppropriateAlertIfNecessary(IHealthValidationResultMinimal result)
 {
     if (!this.IsEnabled)
     {
         MonitoringAlert.Tracer.TraceDebug <string>((long)this.GetHashCode(), "MonitoringAlert: RaiseAppropriateAlertIfNecessary() for '{0}' is skipped because the alert is disabled!", this.Identity);
         this.m_resetEligible = false;
         return;
     }
     this.m_resetEligible = true;
     TransientErrorInfo.ErrorType errorType;
     if (this.IsValidationSuccessful(result))
     {
         if (this.m_alertSuppression.ReportSuccessPeriodic(out errorType))
         {
             this.RaiseAppropriateEvent(errorType, result);
         }
     }
     else if (this.m_alertSuppression.ReportFailurePeriodic(out errorType))
     {
         this.RaiseAppropriateEvent(errorType, result);
     }
     this.CurrentAlertState             = errorType;
     this.ErrorMessage                  = result.ErrorMessage;
     this.ErrorMessageWithoutFullStatus = result.ErrorMessageWithoutFullStatus;
 }
Exemple #2
0
        protected override bool IsValidationSuccessful(IHealthValidationResultMinimal serverValidationResult)
        {
            int           num           = 0;
            StringBuilder stringBuilder = new StringBuilder(1024);

            foreach (KeyValuePair <Guid, DatabaseStaleStatusAlert> keyValuePair in ((IEnumerable <KeyValuePair <Guid, DatabaseStaleStatusAlert> >) this.m_staleAlerts))
            {
                if (keyValuePair.Value.CurrentAlertState == TransientErrorInfo.ErrorType.Failure)
                {
                    if (num == 0)
                    {
                        stringBuilder.Append(keyValuePair.Value.Identity);
                    }
                    else
                    {
                        stringBuilder.AppendFormat(", {0}", keyValuePair.Value.Identity);
                    }
                    num++;
                }
            }
            string text = stringBuilder.ToString();

            if (num >= RegistryParameters.DatabaseHealthCheckStaleStatusServerLevelMinStaleCopies)
            {
                MonitoringAlert.Tracer.TraceError <int, string>((long)this.GetHashCode(), "ServerLevelDatabaseStaleStatusAlert: IsValidationSuccessful() found {0} stale copy status cached entries. Affected dbs: {1}", num, text);
                serverValidationResult.ErrorMessage = text;
                serverValidationResult.ErrorMessageWithoutFullStatus = text;
                return(false);
            }
            return(true);
        }
 protected override void RaiseRedEvent(IHealthValidationResultMinimal result)
 {
     ReplayCrimsonEvents.DatabaseLevelSiteAvailabilityCheckFailed.Log <string, int, string, Guid>(base.Identity, result.HealthyCopiesCount, EventUtil.TruncateStringInput(result.ErrorMessage, 32766), base.IdentityGuid);
     new EventNotificationItem("msexchangerepl", "DatabaseCopyAvailability", "SingleAvailableCopyCheckFailed", EventUtil.TruncateStringInput(result.ErrorMessage, 32766), ResultSeverityLevel.Critical)
     {
         StateAttribute1 = EventUtil.TruncateStringInput(result.ErrorMessage, 32766)
     }.Publish(false);
 }
        protected override bool IsValidationSuccessful(IHealthValidationResultMinimal serverValidationResult)
        {
            bool          flag          = false;
            StringBuilder stringBuilder = new StringBuilder(1024);
            IEnumerable <DatabasePotentialOneCopyAlert> source = from a in this.m_potentialOneCopyAlert
                                                                 select a.Value;
            IEnumerable <DatabasePotentialOneCopyAlert> source2 = from r in source
                                                                  where r.CurrentAlertState == TransientErrorInfo.ErrorType.Failure
                                                                  select r;

            if (source2.Any <DatabasePotentialOneCopyAlert>())
            {
                IEnumerable <DatabasePotentialOneCopyAlert> source3 = from f in source2
                                                                      where !string.IsNullOrEmpty(f.TargetServer)
                                                                      select f;
                if (!source3.Any <DatabasePotentialOneCopyAlert>())
                {
                    MonitoringAlert.Tracer.TraceWarning <int>((long)this.GetHashCode(), "ServerLevelDatabasePotentialRedundancyAlert: None of the DatabasePotentialOneCopyAlert ({0}) has valid server name", source2.Count <DatabasePotentialOneCopyAlert>());
                }
                else
                {
                    IEnumerable <IGrouping <string, DatabasePotentialOneCopyAlert> > source4 = source3.GroupBy((DatabasePotentialOneCopyAlert a) => a.TargetServer, StringComparer.OrdinalIgnoreCase);
                    IGrouping <string, DatabasePotentialOneCopyAlert> grouping = source4.FirstOrDefault <IGrouping <string, DatabasePotentialOneCopyAlert> >();
                    string targetServer = grouping.Key;
                    if (source4.Count <IGrouping <string, DatabasePotentialOneCopyAlert> >() > 1)
                    {
                        IEnumerable <string> values = from f in source4
                                                      select f.Key;
                        string text = string.Join(", ", values);
                        MonitoringAlert.Tracer.TraceWarning <string, string>((long)this.GetHashCode(), "ServerLevelDatabasePotentialRedundancyAlert: Found two or more servers with potential redundancy issues: {0}, will notify Active Monitoring to do recovery actions on the first server '{1}'", text, targetServer);
                        ReplayCrimsonEvents.PotentialRedundancyAlertByRemoteServerCheckTwoOrMoreServersFound.LogPeriodic <string, string>(text, TimeSpan.FromMinutes(30.0), text, targetServer);
                    }
                    flag = true;
                    this.m_RemoteServer = targetServer;
                    DatabasePotentialOneCopyAlert[] array = grouping.ToArray <DatabasePotentialOneCopyAlert>();
                    stringBuilder.Append(string.Join(", ", from f in array
                                                     select f.Identity));
                    from r in source
                    where r.TargetServer == targetServer
                    select r.Identity;
                    stringBuilder.AppendLine();
                    stringBuilder.AppendLine();
                    foreach (DatabasePotentialOneCopyAlert databasePotentialOneCopyAlert in array)
                    {
                        stringBuilder.AppendFormat("{0} - {1}", databasePotentialOneCopyAlert.Identity, databasePotentialOneCopyAlert.ErrorMessageWithoutFullStatus);
                        stringBuilder.AppendLine();
                    }
                    serverValidationResult.ErrorMessage = stringBuilder.ToString();
                    serverValidationResult.ErrorMessageWithoutFullStatus = serverValidationResult.ErrorMessage;
                }
            }
            IEnumerable <DatabasePotentialOneCopyAlert> source5 = from r in source
                                                                  where r.CurrentAlertState == TransientErrorInfo.ErrorType.Success
                                                                  select r;

            this.m_suppressEventsDueToStartup = (!source5.Any <DatabasePotentialOneCopyAlert>() && !flag);
            return(!flag);
        }
 protected override void RaiseRedEvent(IHealthValidationResultMinimal result)
 {
     ReplayEventLogConstants.Tuple_MonitoringDatabaseRedundancyCheckFailed.LogEvent(null, new object[]
     {
         base.Identity,
         result.HealthyCopiesCount,
         EventUtil.TruncateStringInput(result.ErrorMessage, 32766)
     });
     ReplayCrimsonEvents.DatabaseLevelRedundancyCheckFailed.Log <string, int, string, Guid>(base.Identity, result.HealthyCopiesCount, EventUtil.TruncateStringInput(result.ErrorMessage, 32766), base.IdentityGuid);
 }
Exemple #6
0
        protected virtual MonitoringAlert GetExistingOrNewAlertInfo(IHealthValidationResultMinimal result)
        {
            TAlert talert       = default(TAlert);
            Guid   identityGuid = result.IdentityGuid;

            if (!this.m_alertTable.TryGetValue(identityGuid, out talert))
            {
                talert = this.m_createAlertDelegate(result);
                this.m_alertTable[identityGuid] = talert;
            }
            return(talert);
        }
 protected override void RaiseGreenEvent(IHealthValidationResultMinimal result)
 {
     if (!this.m_suppressEventsDueToStartup)
     {
         ReplayCrimsonEvents.PotentialRedundancyAlertByRemoteServerCheckPassed.Log <string>(Environment.MachineName);
         new EventNotificationItem("msexchangerepl", "DatabaseRedundancy", "PotentialOneCopyByRemoteServerEvent", ResultSeverityLevel.Informational)
         {
             StateAttribute1 = string.Empty,
             StateAttribute2 = string.Empty
         }.Publish(false);
     }
 }
 protected override void RaiseRedEvent(IHealthValidationResultMinimal result)
 {
     if (!this.m_suppressEventsDueToStartup)
     {
         ReplayCrimsonEvents.PotentialRedundancyAlertByRemoteServerCheckFailed.Log <string, string, string>(Environment.MachineName, this.RemoteServer, EventUtil.TruncateStringInput(result.ErrorMessage, 32766));
         new EventNotificationItem("msexchangerepl", "DatabaseRedundancy", "PotentialOneCopyByRemoteServerEvent", ResultSeverityLevel.Critical)
         {
             StateAttribute1 = this.RemoteServer,
             StateAttribute2 = EventUtil.TruncateStringInput(result.ErrorMessage, 16383)
         }.Publish(false);
     }
 }
Exemple #9
0
        protected override MonitoringAlert GetExistingOrNewAlertInfo(IHealthValidationResultMinimal result)
        {
            DatabasePotentialOneCopyAlert databasePotentialOneCopyAlert = (DatabasePotentialOneCopyAlert)base.GetExistingOrNewAlertInfo(result);
            string activeServerName = PotentialOneRedundantCopyAlertTable.GetActiveServerName(result);

            if (databasePotentialOneCopyAlert.TargetServer != activeServerName)
            {
                DatabaseAlertInfoTable <DatabasePotentialOneCopyAlert> .Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "PotentialOneRedundantCopyAlertTable::GetExistingOrNewAlertInfo: TargetServer has been changed, create one new alert for {0}, new TargetServer is {1}", result.Identity, activeServerName);

                base.RemoveDatabaseAlert(result.IdentityGuid);
                databasePotentialOneCopyAlert = (DatabasePotentialOneCopyAlert)base.GetExistingOrNewAlertInfo(result);
            }
            return(databasePotentialOneCopyAlert);
        }
Exemple #10
0
        // Token: 0x060013BD RID: 5053 RVA: 0x000506CC File Offset: 0x0004E8CC
        private IEnumerable <IHealthValidationResultMinimal> RunChecks <TValidator>(Func <IADDatabase, TValidator> createValidatorFunc, Guid?dbGuid = null, bool skipUnMonitoredDatabase = true) where TValidator : DatabaseValidatorBase
        {
            IEnumerable <IADDatabase> databases = this.ADConfig.DatabasesIncludingMisconfiguredMap[this.ADConfig.TargetServerName];

            foreach (IADDatabase db in databases)
            {
                if ((!skipUnMonitoredDatabase || DatabaseHealthMonitor.ShouldMonitorDatabase(db)) && (dbGuid == null || db.Guid.Equals(dbGuid.Value)))
                {
                    TValidator validator = createValidatorFunc(db);
                    IHealthValidationResultMinimal result = validator.Run();
                    yield return(result);
                }
            }
            yield break;
        }
Exemple #11
0
        private static string GetActiveServerName(IHealthValidationResultMinimal validationResult)
        {
            IHealthValidationResult healthValidationResult = (IHealthValidationResult)validationResult;
            string result = null;

            if (healthValidationResult.ActiveCopyStatus != null)
            {
                result = healthValidationResult.ActiveCopyStatus.ServerContacted.NetbiosName;
            }
            else if (healthValidationResult.TargetCopyStatus != null && healthValidationResult.TargetCopyStatus.ActiveServer != null)
            {
                result = healthValidationResult.TargetCopyStatus.ActiveServer.NetbiosName;
            }
            return(result);
        }
Exemple #12
0
 // Token: 0x06001411 RID: 5137 RVA: 0x0005111C File Offset: 0x0004F31C
 protected override void RaiseGreenEvent(IHealthValidationResultMinimal result)
 {
     if (!this.m_suppressEventsDueToStartup)
     {
         ReplayEventLogConstants.Tuple_MonitoringDatabaseRedundancyServerCheckPassed.LogEvent(null, new object[]
         {
             base.Identity
         });
         new EventNotificationItem("msexchangerepl", "DatabaseRedundancy", "OneCopyServerEvent", ResultSeverityLevel.Informational)
         {
             StateAttribute1 = base.Identity,
             StateAttribute2 = string.Empty
         }.Publish(false);
     }
     this.WriteLastRunTime();
 }
Exemple #13
0
 // Token: 0x06001412 RID: 5138 RVA: 0x00051188 File Offset: 0x0004F388
 protected override void RaiseRedEvent(IHealthValidationResultMinimal result)
 {
     if (!this.m_suppressEventsDueToStartup)
     {
         ReplayEventLogConstants.Tuple_MonitoringDatabaseRedundancyServerCheckFailed.LogEvent(null, new object[]
         {
             base.Identity,
             EventUtil.TruncateStringInput(result.ErrorMessage, 32766)
         });
         new EventNotificationItem("msexchangerepl", "DatabaseRedundancy", "OneCopyServerEvent", ResultSeverityLevel.Critical)
         {
             StateAttribute1 = base.Identity,
             StateAttribute2 = EventUtil.TruncateStringInput(result.ErrorMessage, 16383)
         }.Publish(false);
     }
     this.WriteLastRunTime();
 }
Exemple #14
0
        // Token: 0x06001410 RID: 5136 RVA: 0x00050FB8 File Offset: 0x0004F1B8
        protected override bool IsValidationSuccessful(IHealthValidationResultMinimal serverValidationResult)
        {
            bool          flag          = false;
            bool          flag2         = false;
            StringBuilder stringBuilder = new StringBuilder(1024);

            foreach (KeyValuePair <Guid, DatabaseRedundancyAlert> keyValuePair in ((IEnumerable <KeyValuePair <Guid, DatabaseRedundancyAlert> >) this.m_oneCopyAlerts))
            {
                if (keyValuePair.Value.CurrentAlertState == TransientErrorInfo.ErrorType.Failure)
                {
                    if (!flag)
                    {
                        stringBuilder.Append(keyValuePair.Value.Identity);
                        flag = true;
                    }
                    else
                    {
                        stringBuilder.AppendFormat(", {0}", keyValuePair.Value.Identity);
                    }
                }
                else if (keyValuePair.Value.CurrentAlertState == TransientErrorInfo.ErrorType.Success)
                {
                    flag2 = true;
                }
            }
            if (flag)
            {
                stringBuilder.AppendLine();
                stringBuilder.AppendLine();
                foreach (KeyValuePair <Guid, DatabaseRedundancyAlert> keyValuePair2 in ((IEnumerable <KeyValuePair <Guid, DatabaseRedundancyAlert> >) this.m_oneCopyAlerts))
                {
                    if (keyValuePair2.Value.CurrentAlertState == TransientErrorInfo.ErrorType.Failure)
                    {
                        stringBuilder.AppendFormat("{0} - {1}", keyValuePair2.Value.Identity, keyValuePair2.Value.ErrorMessageWithoutFullStatus);
                        stringBuilder.AppendLine();
                    }
                }
                serverValidationResult.ErrorMessage = stringBuilder.ToString();
                serverValidationResult.ErrorMessageWithoutFullStatus = serverValidationResult.ErrorMessage;
            }
            this.m_suppressEventsDueToStartup = (!flag2 && !flag);
            return(!flag);
        }
 // Token: 0x0600142C RID: 5164 RVA: 0x00051786 File Offset: 0x0004F986
 protected override void RaiseRedEvent(IHealthValidationResultMinimal result)
 {
     MonitoringAlert.Tracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "DatabaseStaleStatusAlert: RaiseRedEvent() called for DB '{0}' ({1})", result.Identity, result.IdentityGuid);
     ReplayCrimsonEvents.DatabaseStaleStatusCheckFailed.Log <Guid, string>(base.IdentityGuid, base.Identity);
 }
Exemple #16
0
 protected override bool IsValidationSuccessful(IHealthValidationResultMinimal serverValidationResult)
 {
     return(serverValidationResult.HealthyCopiesCount > 2);
 }
Exemple #17
0
 private void RaiseAppropriateEvent(TransientErrorInfo.ErrorType currentState, IHealthValidationResultMinimal result)
 {
     if (currentState == TransientErrorInfo.ErrorType.Success)
     {
         this.RaiseGreenEvent(result);
         return;
     }
     if (currentState == TransientErrorInfo.ErrorType.Failure)
     {
         this.RaiseRedEvent(result);
     }
 }
Exemple #18
0
 protected abstract void RaiseRedEvent(IHealthValidationResultMinimal result);
Exemple #19
0
 protected virtual bool IsValidationSuccessful(IHealthValidationResultMinimal result)
 {
     return(result.IsValidationSuccessful);
 }
 // Token: 0x0600142A RID: 5162 RVA: 0x00051757 File Offset: 0x0004F957
 protected override bool IsValidationSuccessful(IHealthValidationResultMinimal result)
 {
     return(!result.IsAnyCachedCopyStatusStale);
 }
 // Token: 0x0600142B RID: 5163 RVA: 0x00051762 File Offset: 0x0004F962
 protected override void RaiseGreenEvent(IHealthValidationResultMinimal result)
 {
     MonitoringAlert.Tracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "DatabaseStaleStatusAlert: RaiseGreenEvent() called for DB '{0}' ({1})", result.Identity, result.IdentityGuid);
 }
 // Token: 0x060013EF RID: 5103 RVA: 0x00050B83 File Offset: 0x0004ED83
 protected override bool IsValidationSuccessful(IHealthValidationResultMinimal result)
 {
     return(result.IsSiteValidationSuccessful);
 }
Exemple #23
0
 protected override void RaiseGreenEvent(IHealthValidationResultMinimal result)
 {
     ReplayCrimsonEvents.DatabaseLevelAvailabilityCheckPassed.Log <string, int, string, Guid>(base.Identity, result.HealthyCopiesCount, EventUtil.TruncateStringInput(result.ErrorMessage, 32766), base.IdentityGuid);
 }
Exemple #24
0
 protected override void RaiseGreenEvent(IHealthValidationResultMinimal result)
 {
     MonitoringAlert.Tracer.TraceDebug((long)this.GetHashCode(), "ServerLevelDatabaseStaleStatusAlert: RaiseGreenEvent() called!");
 }
Exemple #25
0
        private static DatabasePotentialOneCopyAlert CreateDatabaseOneRedundantCopyAlert(IHealthValidationResultMinimal validationResult)
        {
            string activeServerName = PotentialOneRedundantCopyAlertTable.GetActiveServerName(validationResult);

            return(new DatabasePotentialOneCopyAlert(validationResult.Identity, validationResult.IdentityGuid, activeServerName));
        }
Exemple #26
0
 protected override void RaiseRedEvent(IHealthValidationResultMinimal result)
 {
     ReplayCrimsonEvents.ServerLevelDatabaseStaleStatusCheckFailed.Log <string, string>(base.Identity, EventUtil.TruncateStringInput(result.ErrorMessage, 32766));
     MonitoringAlert.Tracer.TraceError((long)this.GetHashCode(), "ServerLevelDatabaseStaleStatusAlert: RaiseRedEvent() called! Recovery will be attempted via Bugcheck.");
     BugcheckHelper.TriggerBugcheckIfRequired(DateTime.UtcNow, "ServerLevelDatabaseStaleStatusAlert is attempting recovery via BugCheck due to hung GetCopyStatus() RPC.");
 }
Exemple #27
0
        public void RaiseAppropriateAlertIfNecessary(IHealthValidationResultMinimal result)
        {
            MonitoringAlert existingOrNewAlertInfo = this.GetExistingOrNewAlertInfo(result);

            existingOrNewAlertInfo.RaiseAppropriateAlertIfNecessary(result);
        }
Exemple #28
0
 protected override void RaiseRedEvent(IHealthValidationResultMinimal result)
 {
 }