Esempio n. 1
0
        private void CheckServiceStatus()
        {
            if (_status == Status.Started)
            {
                logService.Log(LogLevel.Debug, "  ");
                logService.Log(LogLevel.Debug, "Checking service status");

                if (isDatatecDown())
                {
                    RestartWindowsService();
                }
                else
                if (timeService.IsActiveHours() && timeService.EncuentraSilencioAnormal())
                {
                    TimeSpan time = timeService.TimeSpanSinceLastEvent();
                    logService.Log(LogLevel.Warn, String.Format("Tiempo desde el ultimo evento: {0}", time.ToString()));
                    notificationService.SendNotification(String.Format("Tiempo desde el ultimo evento: {0}", time.ToString()));
                }
            }
            else
            {
                logService.Log(LogLevel.Info, String.Format("Service {0} Down.", _datatecServiceName));
                notificationService.SendNotification(String.Format("Service {0} Down.", _datatecServiceName));
            }
        }