Пример #1
0
        public PDBNotification GetProccessControlNotification()
        {
            var datatable = this.pdbNotificationRepository.GetFailingProcessControls();

            if (datatable.Rows.Count <= 0)
            {
                return(null);
            }

            var totalFailingProcessControls = datatable.Rows.Count;

            var failingProcessControls = (from DataRow d in datatable.Rows
                                          select new
            {
                ProcessControlID = d.Field <int>("ProcessControlID"),
                ProcessTypeDesc = d.Field <string>("ProcessTypeDesc"),
            }).ToList();

            var notification = new PDBNotification
            {
                Type    = NotificationType.Critical,
                Message = string.Format(
                    Messages.Notification.ProcessControlFailed,
                    totalFailingProcessControls,
                    string.Join(", ", failingProcessControls.Select(fpc => fpc.ProcessControlID + "-" + fpc.ProcessTypeDesc)))
            };

            return(notification);
        }
Пример #2
0
        public PDBNotification GetAgentsAlert()
        {
            var datatable = this.pdbNotificationRepository.GetAgentsAlert();

            if (datatable.Rows.Count <= 0)
            {
                return(null);
            }

            var disabledAgents = (from DataRow d in datatable.Rows
                                  select new
            {
                NumberOfAgents = d.Field <int>("NumberOfAgents"),
                AgentName = d.Field <string>("Name"),
            }).Where(da => da.NumberOfAgents == 0 && !da.AgentName.Contains("Trust")).ToList();

            // Keeping the trust exception since the trust agent is not fully removed yet

            if (disabledAgents.Any() == false)
            {
                return(null);
            }

            var notification = new PDBNotification
            {
                Type    = NotificationType.Warning,
                Message = string.Format(Messages.Notification.NoAgentsEnabled, string.Join(", ", disabledAgents.Select(a => a.AgentName)))
            };

            return(notification);
        }
Пример #3
0
        public PDBNotification GetSqlAgentsAlert()
        {
            var secondsSinceLastRecord = this.pdbNotificationRepository.GetSecondsSinceLastAgentHistoryRecord();

            if (secondsSinceLastRecord.HasValue == false || secondsSinceLastRecord > 600)
            {
                var notification = new PDBNotification()
                {
                    Type    = NotificationType.Warning,
                    Message = Messages.Notification.NoSqlAgentsReporting
                };
                return(notification);
            }

            return(null);
        }