public void WriteMonitoringEvents(MonitoringData monitoringData, string momEventSource) { if (!this.HasEvents()) { ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "WriteMonitoringEvents(): No events have been logged. m_Events.Count = 0"); return; } foreach (ReplicationEvent replicationEvent in this.m_MomEvents.Values) { MonitoringEvent monitoringEvent = replicationEvent.ConvertToMonitoringEvent(momEventSource, true); ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "WriteMonitoringEvents(): Adding Monitoring Event with message: '{0}'", monitoringEvent.EventMessage); monitoringData.Events.Add(monitoringEvent); } foreach (Dictionary <string, ReplicationEvent> dictionary in this.m_AppLogSingleEvents.Values) { foreach (KeyValuePair <string, ReplicationEvent> keyValuePair in dictionary) { keyValuePair.Value.PublishToApplicationEventLog(true, keyValuePair.Key); } } }
protected void OutputMonitoringData() { if (this.MonitoringContext.IsPresent) { MonitoringData monitoringData = new MonitoringData(); foreach (WebServicesTestOutcome webServicesTestOutcome in this.outcomes) { MonitoringEvent item = new MonitoringEvent("MSExchange Monitoring " + this.CmdletName, webServicesTestOutcome.MonitoringEventId, TestWebServicesTaskBase.EventTypeFromCasResultEnum(webServicesTestOutcome.Result), webServicesTestOutcome.ToString()); monitoringData.Events.Add(item); if (Datacenter.IsMultiTenancyEnabled()) { EventLogEntryType entryType = EventLogEntryType.Information; string text; if (webServicesTestOutcome.Result == CasTransactionResultEnum.Failure) { entryType = EventLogEntryType.Error; text = Strings.WebServicesTestErrorEventDetail(this.CmdletName, webServicesTestOutcome.Scenario.ToString(), webServicesTestOutcome.Result.ToString(), webServicesTestOutcome.Latency.ToString(), webServicesTestOutcome.Error, webServicesTestOutcome.Verbose); } else if (webServicesTestOutcome.Result == CasTransactionResultEnum.Skipped) { entryType = EventLogEntryType.Warning; text = Strings.WebServicesTestEventDetail(this.CmdletName, webServicesTestOutcome.Scenario.ToString(), webServicesTestOutcome.Result.ToString(), string.Empty); } else { text = Strings.WebServicesTestEventDetail(this.CmdletName, webServicesTestOutcome.Scenario.ToString(), webServicesTestOutcome.Result.ToString(), webServicesTestOutcome.Latency.ToString()); } ExEventLog.EventTuple tuple = new ExEventLog.EventTuple((uint)webServicesTestOutcome.MonitoringEventId, 0, entryType, ExEventLog.EventLevel.Lowest, ExEventLog.EventPeriod.LogAlways); TestWebServicesTaskBase.EventLog.LogEvent(tuple, string.Empty, new object[] { text }); } } base.WriteObject(monitoringData); } }
private ActiveDirectoryConnectivityContext(TestActiveDirectoryConnectivityTask instance, MonitoringData monitoringData, string domainController) { this.instance = instance; this.monitoringData = monitoringData; this.domainController = domainController; this.logger = new TaskLoggerAdaptor(this.Instance); if (this.MonitoringData != null) { this.logger.Append(new StringLogger()); } }
internal static ActiveDirectoryConnectivityContext CreateForActiveDirectoryConnectivity(TestActiveDirectoryConnectivityTask instance, MonitoringData monitoringData, string domainController) { return(new ActiveDirectoryConnectivityContext(instance, monitoringData, domainController)); }