public bool Execute(ProcessControl processControl)
        {
            if (SqlRepo.AdminScriptsInstalled() == false)
            {
                LogWarning("Installation of Performance Dashboard is incomplete. Please install the latest scripts from PDB's custom pages.");
                return(true);
            }

            bool bSuccess = true;

            base.ExecuteForServers(server =>
            {
                try
                {
                    if (server.ServerTypeId == (int)ServerType.Database)
                    {
                        SqlRepo.EnvironmentCheckRepository.ExecuteCollectDatabaseDetails(server.ServerName);
                    }

                    var serverDetails = GetServerDetails(server);
                    SqlRepo.EnvironmentCheckRepository.SaveServerDetails(serverDetails);
                }
                catch (COMException exception)
                {
                    // Catch RPC exception and swallow for now, but log error to investigate and continue attempting to get details from other servers.
                    bSuccess = false;
                    LogError($"Caught exception ({exception.Message}) for server {server.ServerName}.  Skipping and continuing environment check for other servers.");
                }
            });
            return(bSuccess);
        }
 public bool Execute(ProcessControl processControl)
 {
     if (SqlRepo.AdminScriptsInstalled() == false)
     {
         LogWarning("Installation of Performance Dashboard is incomplete. Please install the latest scripts from PDB's custom pages.");
         return(true);
     }
     SqlRepo.SummarizeSqlServerPageouts();
     return(true);
 }
 public bool Execute(ProcessControl processControl)
 {
     if (SqlRepo.AdminScriptsInstalled() == false)
     {
         LogWarning("Installation of Performance Dashboard is incomplete. Please install the latest scripts from PDB's custom pages.");
         return(true);
     }
     SqlRepo.EnvironmentCheckRepository.ExecuteTuningForkRelativity();
     return(true);
 }
 public bool Execute(ProcessControl processControl)
 {
     if (SqlRepo.AdminScriptsInstalled() == false)
     {
         LogWarning("Installation of Performance Dashboard is incomplete. Please install the latest scripts from PDB's custom pages.");
         return(true);
     }
     SqlRepo.ExecuteVirtualLogFileMonitor(AgentId);
     return(true);
 }
        public bool Execute(ProcessControl processControl)
        {
            /*
             * TODO -- Refactor this mess in the future
             * -- Get EDDSPerformance server instead of PrimarySqlServer (currently tied together)
             * //*/
            var registeredSqlServers = SqlRepo.GetRegisteredSQLServers();
            var primary = this.SqlRepo.PrimarySqlServerRepository.GetPrimarySqlServer();

            ExecuteForServers(server =>
            {
                if (server.ServerTypeId == (int)ServerType.Database &&
                    registeredSqlServers.Select(s => s.Name).Any(s => s.ToLower() == server.ServerName.ToLower()))
                {
                    SqlRepo.FileLatencyRepository.ExecuteSaveFileLevelLatencyDetails(server.ServerName, primary.Name);
                }
            });
            return(true);
        }
Example #6
0
        public bool Execute(ProcessControl processControl)
        {
            if (SqlRepo.AdminScriptsInstalled() == false)
            {
                LogWarning("Installation of Performance Dashboard is incomplete. Please install the latest scripts from PDB's custom pages.");
                return(true);
            }

            var  checkIFIEnabledValue = SqlRepo.ConfigurationRepository.ReadConfigurationValue(ConfigurationKeys.Section, ConfigurationKeys.EnableInstantFileInitializationCheck);
            bool checkIFIEnabled;

            Boolean.TryParse(checkIFIEnabledValue, out checkIFIEnabled);

            Exception firstFailureException = null;
            Server    firstFailureServer    = null;

            ExecuteForServers(server =>
            {
                if (server.ServerTypeId == (int)ServerType.Database)
                {
                    try
                    {
                        ExecuteTuningForkForServer(server, checkIFIEnabled);
                    }
                    catch (Exception ex)
                    {
                        firstFailureServer    = firstFailureServer ?? server;
                        firstFailureException = firstFailureException ?? ex;
                    }
                }
            });

            if (firstFailureException != null)
            {
                var message = firstFailureException.GetExceptionDetails();
                LogError("Failure Running tunning for {0}. Details: {1}", firstFailureServer.ServerName, message);
                processControl.LastErrorMessage = firstFailureException.ToString();
                return(false);
            }

            return(true);
        }
Example #7
0
        public static void Main(string[] args)
        {
            var repo = new SqlRepo <Model>("test", "Data Source=123.207.111.61;User ID=sa;Password=Ss303384755;Initial Catalog=brnmall;Pooling=true", "System.Data.SqlClient");
            //var model1 = new Model() { contents = "1" };
            //var model2 = new Model() { contents = "2" };
            //repo.Add(model1);
            //repo.Add(model2);

            //var model3 = repo.Get(1);

            //model1.contents = "3";
            //repo.Update(model1);

            //repo.Remove(model2);
            //repo.SaveChanges();

            //var list = repo.Query.Where(m => m.id > 1).ToList();
            //var single = repo.Query.Where(m => m.id > 1).Single();
            //var subPage = repo.Query.Where(m => m.id > 1).OrderByDescending( m=> m.id ).Skip(1).Take(5).ToList();
            //var count = repo.Query.Where(m => m.id > 1).Count();
            var m1 = repo.Query.Select(m => new { id1 = m.id }).First();
        }
Example #8
0
 public bool Execute(ProcessControl processControl)
 {
     //Run wait monitor
     SqlRepo.ExecuteWaitMonitor(AgentId);
     return(true);
 }
Example #9
0
 public bool Execute(ProcessControl processControl)
 {
     SqlRepo.CleanupDataTables();
     return(true);
 }
        public bool Execute(ProcessControl processControl)
        {
            if (SqlRepo.AdminScriptsInstalled() == false)
            {
                LogWarning("Installation of Performance Dashboard is incomplete. Please install the latest scripts from PDB's custom pages.");
                return(true);
            }

            var processCtrl            = this.SqlRepo.ProcessControlRepository.ReadById(ProcessControlId.CycleErrorLog);
            var updateLastExecutedTime = false;

            if (processCtrl == null)
            {
                return(true);
            }

            var execSucceeded = processCtrl.LastExecSucceeded;
            var utcDate       = DateTime.UtcNow;

            try
            {
                this.Log("Called");

                var interval = processCtrl.Frequency.GetValueOrDefault(10080);

                if (interval > 0 && processCtrl.LastProcessExecDateTime.AddMinutes(interval) <= utcDate)
                {
                    updateLastExecutedTime = true;

                    // QoS_CycleErrorLog needs to be run on every active SQL server associated with Relativity
                    var servers = this.SqlRepo.GetRegisteredSQLServers();

                    foreach (var server in servers)
                    {
                        // Run the procedure
                        SqlRepo.CycleSqlErrorLog(server.Name);
                    }

                    execSucceeded = true;
                }
                else
                {
                    this.Log("Called - Skipping due to Interval");
                }
            }
            catch (Exception ex)
            {
                var message = ex.GetExceptionDetails();
                this.LogError("Called - Failure. Details: {0}", message);
                execSucceeded = false;
                processCtrl.LastErrorMessage = ex.ToString();
            }
            finally
            {
                if (updateLastExecutedTime)
                {
                    processCtrl.LastProcessExecDateTime = utcDate;
                }

                processCtrl.LastExecSucceeded = execSucceeded;
                this.SqlRepo.ProcessControlRepository.Update(processControl);
            }

            return(true);
        }
Example #11
0
 public static void InitRepo(IDatabaseConfig hostConfig)
 {
     Repo = new SqlRepo(hostConfig);
 }