private static string BuildFormatedWatermarks(MailboxAssistantsWatermarks.WatermarkWithCreateTime[] watermarks) { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < watermarks.Length; i++) { stringBuilder.Append(watermarks[i].ConsumerGuid); stringBuilder.Append(":"); stringBuilder.Append(MailboxAssistantsWatermarks.BuildFormatedEventCounter(watermarks[i].EventCounter, watermarks[i].CreateTime)); if (i != watermarks.Length - 1) { stringBuilder.Append(", "); } } return(stringBuilder.ToString()); }
public override MonitoringData InternalRunCheck() { MonitoringData monitoringData = new MonitoringData(); if (base.ExchangeServer.AdminDisplayVersion.Major < MailboxAssistantsWatermarks.minExpectedServerVersion.Major || (base.ExchangeServer.AdminDisplayVersion.Major == MailboxAssistantsWatermarks.minExpectedServerVersion.Major && base.ExchangeServer.AdminDisplayVersion.Minor < MailboxAssistantsWatermarks.minExpectedServerVersion.Minor)) { monitoringData.Events.Add(new MonitoringEvent(AssistantTroubleshooterBase.EventSource, 5101, EventTypeEnumeration.Warning, Strings.TSMinServerVersion(MailboxAssistantsWatermarks.minExpectedServerVersion.ToString()))); return(monitoringData); } using (ExRpcAdmin exRpcAdmin = ExRpcAdmin.Create("Client=Management", base.ExchangeServer.Name, null, null, null)) { List <MdbStatus> onlineMDBList = base.GetOnlineMDBList(exRpcAdmin); foreach (MdbStatus mdbStatus in onlineMDBList) { Guid empty = Guid.Empty; Watermark[] watermarksForMailbox = exRpcAdmin.GetWatermarksForMailbox(mdbStatus.MdbGuid, ref empty, Guid.Empty); MapiEventManager mapiEventManager = MapiEventManager.Create(exRpcAdmin, Guid.Empty, mdbStatus.MdbGuid); long eventCounter = mapiEventManager.ReadLastEvent().EventCounter; bool flag = false; foreach (Watermark watermark in watermarksForMailbox) { if (eventCounter - watermark.EventCounter > 50L) { flag = true; break; } } if (flag) { MailboxAssistantsWatermarks.WatermarkWithCreateTime[] array2 = MailboxAssistantsWatermarks.BuildWaterMarkWithCreateTimes(mapiEventManager, watermarksForMailbox); DateTime eventTime = MailboxAssistantsWatermarks.GetEventTime(mapiEventManager, eventCounter); List <MailboxAssistantsWatermarks.WatermarkWithCreateTime> list = new List <MailboxAssistantsWatermarks.WatermarkWithCreateTime>(watermarksForMailbox.Length); foreach (MailboxAssistantsWatermarks.WatermarkWithCreateTime watermarkWithCreateTime in array2) { if (eventTime - watermarkWithCreateTime.CreateTime > this.WatermarkBehindWarningThrehold) { list.Add(watermarkWithCreateTime); } } if (list.Count > 0) { monitoringData.Events.Add(new MonitoringEvent(AssistantTroubleshooterBase.EventSource, 5207, EventTypeEnumeration.Error, Strings.AIMDBWatermarksAreTooLow(base.ExchangeServer.Fqdn, mdbStatus.MdbName, ((int)this.WatermarkBehindWarningThrehold.TotalMinutes).ToString(), MailboxAssistantsWatermarks.BuildFormatedEventCounter(eventCounter, eventTime), MailboxAssistantsWatermarks.BuildFormatedWatermarks(list.ToArray())))); } } } } return(monitoringData); }