private void WriteMonitoringObject()
 {
     if (this.results != null)
     {
         MonitoringEvent item = TestSmtpConnectivity.CreateMonitoringEvent(this.server.Name, this.results);
         this.monitoringData.Events.Add(item);
     }
     base.WriteObject(this.monitoringData);
 }
        protected void AddMonitoringEvent(TestActiveDirectoryConnectivityTask.ScenarioId eventId, EventTypeEnumeration eventType, LocalizedString eventMessage)
        {
            if (this.context.MonitoringData == null)
            {
                return;
            }
            string text = eventMessage.ToString();

            if (eventType != EventTypeEnumeration.Success)
            {
                text = this.context.GetDiagnosticInfo(text);
            }
            MonitoringEvent item = new MonitoringEvent(TestActiveDirectoryConnectivityTask.CmdletMonitoringEventSource, (int)eventId, eventType, text);

            this.context.MonitoringData.Events.Add(item);
        }
Exemple #3
0
 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);
     }
 }