private void RunResolveProblems(MonitoringData monitoringData, List <TroubleshooterCheck> checkList, List <TroubleshooterCheck> failedCheckList)
 {
     if (failedCheckList.Count == 0)
     {
         ExchangeServer exchangeServer = (ExchangeServer)base.Fields["ExchangeServer"];
         monitoringData.Events.Add(new MonitoringEvent(AssistantTroubleshooterBase.EventSource, 5000, EventTypeEnumeration.Information, Strings.TSNoProblemsDetected(exchangeServer.Name)));
         using (List <TroubleshooterCheck> .Enumerator enumerator = checkList.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 TroubleshooterCheck         troubleshooterCheck         = enumerator.Current;
                 AssistantTroubleshooterBase assistantTroubleshooterBase = troubleshooterCheck as AssistantTroubleshooterBase;
                 if (assistantTroubleshooterBase != null)
                 {
                     monitoringData.PerformanceCounters.Add(assistantTroubleshooterBase.GetCrashDumpCountPerformanceCounter());
                     break;
                 }
             }
             return;
         }
     }
     if (this.ResolveProblems.IsPresent)
     {
         foreach (TroubleshooterCheck troubleshooterCheck2 in failedCheckList)
         {
             troubleshooterCheck2.Resolve(monitoringData);
         }
     }
 }
 protected void StartAssistantService(ExchangeServer server, MonitoringData monitoringData)
 {
     try
     {
         using (ServiceController serviceController = new ServiceController("MsExchangeMailboxAssistants", server.Fqdn))
         {
             serviceController.Start();
             serviceController.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromMinutes(5.0));
             monitoringData.Events.Add(new MonitoringEvent(AssistantTroubleshooterBase.EventSource, 5002, EventTypeEnumeration.Information, Strings.MailboxAssistantsServiceStarted(this.ExchangeServer.Name)));
         }
     }
     catch (System.ServiceProcess.TimeoutException ex)
     {
         this.SendWatsonForAssistantProcess(ex, false);
         monitoringData.Events.Add(this.MailboxAssistantsServiceCouldNotBeStarted(this.ExchangeServer.Name, ex.Message));
     }
     catch (InvalidOperationException ex2)
     {
         monitoringData.Events.Add(this.MailboxAssistantsServiceCouldNotBeStarted(this.ExchangeServer.Name, ex2.Message));
     }
     catch (Win32Exception ex3)
     {
         monitoringData.Events.Add(this.MailboxAssistantsServiceCouldNotBeStarted(this.ExchangeServer.Name, ex3.Message));
     }
 }
        public static List <TroubleshooterCheck> RunChecks(ICollection <TroubleshooterCheck> expectedCheckList, TroubleshooterCheck.ContinueToNextCheck continueToNextCheck, out MonitoringData results)
        {
            List <TroubleshooterCheck> list = new List <TroubleshooterCheck>();

            results = new MonitoringData();
            foreach (TroubleshooterCheck troubleshooterCheck in expectedCheckList)
            {
                bool           errorsReturned = false;
                MonitoringData monitoringData = troubleshooterCheck.InternalRunCheck();
                foreach (MonitoringEvent monitoringEvent in monitoringData.Events)
                {
                    if (monitoringEvent.EventType == EventTypeEnumeration.Error)
                    {
                        list.Add(troubleshooterCheck);
                        errorsReturned = true;
                        break;
                    }
                }
                results.Events.AddRange(monitoringData.Events);
                results.PerformanceCounters.AddRange(monitoringData.PerformanceCounters);
                if (!continueToNextCheck(troubleshooterCheck, monitoringData, errorsReturned))
                {
                    break;
                }
            }
            return(list);
        }
Exemple #4
0
 protected override void InternalProcessRecord()
 {
     try
     {
         this.Process();
     }
     catch (LocalizedException exception)
     {
         base.WriteError(exception, (ErrorCategory)1003, null);
     }
     finally
     {
         base.WriteObject(Environment.NewLine + "Closing Test-FederationTrust...");
         if (this.MonitoringContext)
         {
             MonitoringData monitoringData = new MonitoringData();
             foreach (TestFederationTrust.ResultEvent resultEvent in this.events)
             {
                 monitoringData.Events.Add(new MonitoringEvent(TestFederationTrust.EventSource, (int)resultEvent.Id, resultEvent.Type, resultEvent.Message));
             }
             base.WriteObject(monitoringData);
         }
         else
         {
             foreach (TestFederationTrust.ResultEvent sendToPipeline in this.events)
             {
                 base.WriteObject(sendToPipeline);
             }
         }
     }
 }
Exemple #5
0
        public override MonitoringData InternalRunCheck()
        {
            MonitoringData monitoringData = new MonitoringData();

            if (!base.ExchangeServer.IsMailboxServer)
            {
                monitoringData.Events.Add(new MonitoringEvent(AssistantTroubleshooterBase.EventSource, 5200, EventTypeEnumeration.Error, Strings.TSNotAMailboxServer(base.ExchangeServer.Name)));
            }
            return(monitoringData);
        }
        protected override void InternalProcessRecord()
        {
            TaskLogger.LogEnter();
            base.InternalProcessRecord();
            MonitoringData             monitoringData  = null;
            List <TroubleshooterCheck> checkList       = this.GetCheckList();
            List <TroubleshooterCheck> failedCheckList = TroubleshooterCheck.RunChecks(checkList, new TroubleshooterCheck.ContinueToNextCheck(TroubleshooterCheck.ShouldContinue), out monitoringData);

            this.RunResolveProblems(monitoringData, checkList, failedCheckList);
            base.WriteObject(monitoringData, true);
            TaskLogger.LogExit();
        }
Exemple #7
0
        public override MonitoringData InternalRunCheck()
        {
            MonitoringData monitoringData = new MonitoringData();

            using (ServiceController serviceController = new ServiceController("MsExchangeMailboxAssistants", base.ExchangeServer.Fqdn))
            {
                if (serviceController.Status != ServiceControllerStatus.Running)
                {
                    monitoringData.Events.Add(new MonitoringEvent(AssistantTroubleshooterBase.EventSource, 5201, EventTypeEnumeration.Error, Strings.MailboxAssistantsServiceNotRunning(base.ExchangeServer.Fqdn, serviceController.Status.ToString())));
                }
            }
            return(monitoringData);
        }
 public override MonitoringData Resolve(MonitoringData monitoringData)
 {
     foreach (MonitoringEvent monitoringEvent in monitoringData.Events)
     {
         if (monitoringEvent.EventIdentifier == 5002)
         {
             return(monitoringData);
         }
     }
     this.GetWatsonExceptionBucketAndSendWatson(false);
     this.RestartAssistantService(monitoringData);
     monitoringData.PerformanceCounters.Add(this.GetCrashDumpCountPerformanceCounter());
     return(monitoringData);
 }
Exemple #9
0
        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);
        }
        public static (MonitoringData, string) ProcessRawData(MonitoringInput rawData, string path)
        {
            string log = "";

            foreach (var row in userData)
            {
                //check if user is needed user
                if (row.Key == rawData.Email)
                {
                    //check if it has recordings
                    if (row.Value == null)
                    {
                        log += "user.value was null";
                        // if not -> then add a recording
                        userData[rawData.Email] = rawData;
                        log += " and I wrote some data";
                        return(null, log);
                    }
                    else if (row.Value != null)
                    {
                        log += "user.value was not null";
                        //compare times
                        var startTime = UnixTimeStampToDateTime(row.Value.Time);
                        var endTime   = UnixTimeStampToDateTime(rawData.Time);
                        var timeSpent = endTime.Subtract(startTime);

                        var            id     = Guid.NewGuid().ToString();
                        MonitoringData result = new MonitoringData {
                            Id    = id,
                            Email = rawData.Email,
                            Time  = timeSpent.ToString(),
                            Title = row.Value.Title,
                            URL   = row.Value.URL
                        };

                        //saveImageFile(id, rawData.ScreenShotBase64, path);
                        //replace recording
                        userData[rawData.Email] = rawData;
                        return(result, log);
                    }
                }
            }
            return(null, log);
        }
        private IDictionary <string, float> CreateMonitoringDataCollection(MonitoringData data)
        {
            var battery1    = data.Battery1Voltage == 0 ? 0 : (data.Battery1Voltage + 275) / 100f;
            var battery2    = data.Battery2Voltage == 0 ? 0 : (data.Battery2Voltage + 275) / 100f;
            var battery3    = data.Battery3Voltage == 0 ? 0 : (data.Battery3Voltage + 275) / 100f;
            var battery4    = data.Battery4Voltage == 0 ? 0 : (data.Battery4Voltage + 275) / 100f;
            var batteryPack = battery1 + battery2 + battery3 + battery4;

            var outputVoltage = data.OutputVoltage / 100f;
            var outputCurrent = data.OutputCurrent / 100f;
            var outputPower   = outputVoltage * outputCurrent;

            {
                m_sensorsData[SensorsKeys.IsFiring]   = data.IsFiring ? 1 : 0;
                m_sensorsData[SensorsKeys.IsCharging] = data.IsCharging ? 1 : 0;
                m_sensorsData[SensorsKeys.IsCelcius]  = data.IsCelcius ? 1 : 0;

                m_sensorsData[SensorsKeys.Battery1]    = battery1;
                m_sensorsData[SensorsKeys.Battery2]    = battery2;
                m_sensorsData[SensorsKeys.Battery3]    = battery3;
                m_sensorsData[SensorsKeys.Battery4]    = battery4;
                m_sensorsData[SensorsKeys.BatteryPack] = batteryPack;

                m_sensorsData[SensorsKeys.Power]          = outputPower;
                m_sensorsData[SensorsKeys.PowerSet]       = data.PowerSet / 10f;
                m_sensorsData[SensorsKeys.TemperatureSet] = data.TemperatureSet;
                m_sensorsData[SensorsKeys.Temperature]    = data.Temperature;

                m_sensorsData[SensorsKeys.OutputVoltage] = outputVoltage;
                m_sensorsData[SensorsKeys.OutputCurrent] = outputCurrent;

                m_sensorsData[SensorsKeys.Resistance]     = data.Resistance / 1000f;
                m_sensorsData[SensorsKeys.RealResistance] = data.RealResistance / 1000f;

                m_sensorsData[SensorsKeys.BoardTemperature] = data.BoardTemperature;
            }
            return(m_sensorsData);
        }
Exemple #12
0
 public override MonitoringData Resolve(MonitoringData monitoringData)
 {
     return(monitoringData);
 }
 public static bool ShouldContinue(TroubleshooterCheck troubleshooterCheck, MonitoringData monitoringData, bool errorsReturned)
 {
     return(!errorsReturned);
 }
Exemple #14
0
        public override MonitoringData InternalRunCheck()
        {
            MonitoringData monitoringData = new MonitoringData();

            if (base.ExchangeServer.AdminDisplayVersion.Major < MailboxAssistantsProcessingEvents.minExpectedServerVersion.Major || (base.ExchangeServer.AdminDisplayVersion.Major == MailboxAssistantsProcessingEvents.minExpectedServerVersion.Major && base.ExchangeServer.AdminDisplayVersion.Minor < MailboxAssistantsProcessingEvents.minExpectedServerVersion.Minor))
            {
                monitoringData.Events.Add(new MonitoringEvent(AssistantTroubleshooterBase.EventSource, 5101, EventTypeEnumeration.Warning, Strings.TSMinServerVersion(MailboxAssistantsProcessingEvents.minExpectedServerVersion.ToString())));
            }
            else
            {
                MonitoringPerformanceCounter mdbstatusUpdateCounterValue = this.GetMDBStatusUpdateCounterValue();
                if (mdbstatusUpdateCounterValue != null)
                {
                    monitoringData.PerformanceCounters.Add(mdbstatusUpdateCounterValue);
                    if (mdbstatusUpdateCounterValue.Value > this.MaxWaitTime)
                    {
                        monitoringData.Events.Add(new MonitoringEvent(AssistantTroubleshooterBase.EventSource, 5206, EventTypeEnumeration.Error, Strings.AIDatabaseStatusPollThreadHung(base.ExchangeServer.Name, mdbstatusUpdateCounterValue.Value)));
                    }
                }
                else
                {
                    monitoringData.Events.Add(this.TSMDBperformanceCounterNotLoaded(base.ExchangeServer.Name, "Elapsed Time since Last Database Status Update Attempt"));
                }
                List <MdbStatus> onlineMDBList = base.GetOnlineMDBList();
                int maximumEventQueueSize      = this.GetMaximumEventQueueSize(base.ExchangeServer.Fqdn);
                foreach (MdbStatus mdbStatus in onlineMDBList)
                {
                    string mdbName = mdbStatus.MdbName;
                    MonitoringPerformanceCounter mdblastEventPollingAttemptCounterValue = this.GetMDBLastEventPollingAttemptCounterValue(mdbName);
                    if (mdblastEventPollingAttemptCounterValue == null)
                    {
                        monitoringData.Events.Add(this.TSMDBperformanceCounterNotLoaded(base.ExchangeServer.Name, "Elapsed Time since Last Event Polling Attempt"));
                    }
                    else
                    {
                        monitoringData.PerformanceCounters.Add(mdblastEventPollingAttemptCounterValue);
                        if (mdblastEventPollingAttemptCounterValue.Value > this.MaxWaitTime)
                        {
                            monitoringData.Events.Add(new MonitoringEvent(AssistantTroubleshooterBase.EventSource, 5205, EventTypeEnumeration.Error, Strings.AIMDBLastEventPollingThreadHung(base.ExchangeServer.Name, mdbName, mdblastEventPollingAttemptCounterValue.Value)));
                        }
                    }
                    MonitoringPerformanceCounter mdblastEventPolledCounterValue = this.GetMDBLastEventPolledCounterValue(mdbName);
                    if (mdblastEventPolledCounterValue == null)
                    {
                        monitoringData.Events.Add(this.TSMDBperformanceCounterNotLoaded(base.ExchangeServer.Name, "Elapsed Time Since Last Event Polled"));
                    }
                    MonitoringPerformanceCounter mdbeventsInQueueCounterValue = this.GetMDBEventsInQueueCounterValue(mdbName);
                    if (mdbeventsInQueueCounterValue == null)
                    {
                        monitoringData.Events.Add(this.TSMDBperformanceCounterNotLoaded(base.ExchangeServer.Name, "Events in queue"));
                    }
                    if (mdblastEventPolledCounterValue != null && mdbeventsInQueueCounterValue != null)
                    {
                        monitoringData.PerformanceCounters.Add(mdblastEventPolledCounterValue);
                        monitoringData.PerformanceCounters.Add(mdbeventsInQueueCounterValue);
                        if (mdbeventsInQueueCounterValue.Value >= (double)maximumEventQueueSize && mdblastEventPolledCounterValue.Value > this.MaxWaitTime)
                        {
                            monitoringData.Events.Add(new MonitoringEvent(AssistantTroubleshooterBase.EventSource, 5205, EventTypeEnumeration.Error, Strings.AIMDBLastEventPollingThreadHung(base.ExchangeServer.Name, mdbName, mdblastEventPolledCounterValue.Value)));
                        }
                    }
                }
            }
            return(monitoringData);
        }
 public CollectRequestMiddleware(RequestDelegate next, MonitoringData monitoringData)
 {
     this._next           = next;
     this._monitoringData = monitoringData;
 }
Exemple #16
0
 public override MonitoringData Resolve(MonitoringData monitoringData)
 {
     monitoringData.Events.Add(base.TSResolutionFailed(base.ExchangeServer.Name));
     return(monitoringData);
 }
 protected void RestartAssistantService(MonitoringData monitoringData)
 {
     this.StopAssistantService(this.ExchangeServer, monitoringData);
     this.StartAssistantService(this.ExchangeServer, monitoringData);
 }
 public ProcessInformationMonitor(MonitoringData monitoringData)
 {
     this._monitoringData = monitoringData;
 }
 public virtual MonitoringData Resolve(MonitoringData monitoringData)
 {
     return(monitoringData);
 }
Exemple #20
0
 public ServeMonitoringDataMiddleware(RequestDelegate next, MonitoringData monitoringData, WebInterfaceFileManager webInterfaceFileManager)
 {
     this._next                    = next;
     this._monitoringData          = monitoringData;
     this._webInterfaceFileManager = webInterfaceFileManager;
 }