// Token: 0x06001E03 RID: 7683 RVA: 0x00089820 File Offset: 0x00087A20 public bool SpaceIsLow(IReplayConfiguration config) { string destinationLogPath = config.DestinationLogPath; ulong num; ulong num2; Exception freeSpace = DiskHelper.GetFreeSpace(destinationLogPath, out num, out num2); if (freeSpace != null) { LooseTruncation.Tracer.TraceError <string, Exception>((long)this.GetHashCode(), "SpaceIsLow: GetFreeSpace() failed against directory '{0}'. Exception: {1}", destinationLogPath, freeSpace); ReplayCrimsonEvents.TruncationFailedToGetDiskSpace.LogPeriodic <string, string, string>(config.Identity, DiagCore.DefaultEventSuppressionInterval, config.Identity, freeSpace.Message, destinationLogPath); return(false); } bool flag = false; long num3 = (long)(num2 / 1048576UL); if (num3 < this.LowSpaceThresholdInMB) { flag = true; } LooseTruncation.Tracer.TraceDebug <bool, long, long>((long)this.GetHashCode(), "SpaceIsLow={0}. FreeMB={1} LowSpaceThresholdInMB={2}", flag, num3, this.LowSpaceThresholdInMB); return(flag); }
internal NotificationAction NotifyLowDiskSpace(IADDatabase db, IMonitoringADConfig adConfig) { DatabaseRedundancyValidator databaseRedundancyValidator = new DatabaseRedundancyValidator(db, 1, this.m_statusLookup, adConfig, null, true); IHealthValidationResult healthValidationResult = databaseRedundancyValidator.Run(); CopyStatusClientCachedEntry targetCopyStatus = healthValidationResult.TargetCopyStatus; if (targetCopyStatus == null || targetCopyStatus.CopyStatus == null || targetCopyStatus.Result != CopyStatusRpcResult.Success || targetCopyStatus.CopyStatus.DiskTotalSpaceBytes == 0UL) { return(NotificationAction.None); } double num = (double)RegistryParameters.SpaceMonitorLowSpaceThresholdInMB / 1024.0; double num2 = targetCopyStatus.CopyStatus.DiskFreeSpaceBytes / 1024.0 / 1024.0 / 1024.0; double num3 = 0.0; double num4 = 0.0; string text = SpaceMonitor.FindVolume(new DirectoryInfo(db.EdbFilePath.PathName)); string text2 = SpaceMonitor.FindVolume(new DirectoryInfo(db.LogFolderPath.PathName)); if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(text2) && !text.Equals(text2, StringComparison.OrdinalIgnoreCase) && db.EdbFilePath.IsLocalFull) { ulong num5 = 0UL; ulong num6 = 0UL; DiskHelper.GetFreeSpace(db.EdbFilePath.PathName, out num5, out num6); num3 = num5 / 1024UL / 1024UL / 1024UL; num4 = num6 / 1024UL / 1024UL / 1024UL; } bool flag = false; string text3 = string.Empty; if (num2 <= num) { text3 = string.Format("'{0}' is low on log volume space [{1}]. Current={2:0.##} GB, Threshold={3:0.##} GB", new object[] { db.Name, text2, num2, num }); flag = true; } if (num3 != 0.0 && num4 <= num) { text3 += string.Format("{0}'{1}' is low on EDB volume space [{2}]. Current={3:0.##} GB, Threshold={4:0.##} GB", new object[] { Environment.NewLine, db.Name, text, num4, num }); flag = true; } if (flag) { if (SpaceMonitor.LastNotificationHistory.ContainsKey(db.Name) && DateTime.UtcNow - SpaceMonitor.LastNotificationHistory[db.Name] < SpaceMonitor.NotificationFrequency) { SpaceMonitor.Tracer.TraceDebug((long)this.GetHashCode(), "SpaceMonitor.ProcessDatabase: Database '{0}' is low on space but notification throttling is hit. LastNotify={1}, Throttling={2}mins, Message={3}", new object[] { db.Name, SpaceMonitor.LastNotificationHistory.ContainsKey(db.Name) ? "Never" : SpaceMonitor.LastNotificationHistory[db.Name].ToString(), SpaceMonitor.NotificationFrequency.TotalMinutes, text3 }); return(NotificationAction.None); } Exception ex; if (BitlockerUtil.IsFilePathOnEncryptingVolume(db.LogFolderPath.PathName, out ex)) { SpaceMonitor.Tracer.TraceDebug <string>((long)this.GetHashCode(), "SpaceMonitor.ProcessDatabase: Database '{0}' is currently encrypting. Do not raise alert.", db.Name); return(NotificationAction.None); } if (ex != null) { string text4 = string.Format("IsFilePathOnEncryptingVolume({0}) failed: {1}", db.LogFolderPath.PathName, ex.Message); ReplayCrimsonEvents.BitlockerQueryFailed.LogPeriodic <string, Exception>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, text4, ex); } EventNotificationItem eventNotificationItem = new EventNotificationItem("MSExchangeDagMgmt", "EdbAndLogVolSpace", db.Name.ToUpper(), text3, text3, ResultSeverityLevel.Critical); eventNotificationItem.Publish(false); if (SpaceMonitor.LastNotificationHistory.ContainsKey(db.Name)) { SpaceMonitor.LastNotificationHistory[db.Name] = DateTime.UtcNow; } else { SpaceMonitor.LastNotificationHistory.Add(db.Name, DateTime.UtcNow); } return(NotificationAction.RedRaised); } else { text3 = string.Format("{0} Status is OK - EdbFreeSpace={1:0.##} GB [{2}], LogFreeSpace={3:0.##} GB [{4}], Threshold={5:0.##} GB", new object[] { db.Name, num4, text, num2, text2, num }); if (SpaceMonitor.LastNotificationHistory.ContainsKey(db.Name) && SpaceMonitor.LastNotificationHistory[db.Name] != DateTime.MinValue) { EventNotificationItem eventNotificationItem2 = new EventNotificationItem("MSExchangeDagMgmt", "EdbAndLogVolSpace", db.Name.ToUpper(), text3, text3, ResultSeverityLevel.Informational); eventNotificationItem2.Publish(false); SpaceMonitor.LastNotificationHistory[db.Name] = DateTime.MinValue; return(NotificationAction.GreenRaised); } SpaceMonitor.Tracer.TraceDebug((long)this.GetHashCode(), "SpaceMonitor.ProcessDatabase: Database '{0}' has enough space but red notification was never raised. LastNotify={1}, Throttling={2}mins, Message={3}", new object[] { db.Name, SpaceMonitor.LastNotificationHistory.ContainsKey(db.Name) ? SpaceMonitor.LastNotificationHistory[db.Name].ToString() : "Never", SpaceMonitor.NotificationFrequency.TotalMinutes, text3 }); return(NotificationAction.None); } }