コード例 #1
0
        public static List <string> FetchServerBasedOnProbeTypes(string ProbeType)
        {
            try
            {
                SQLiteConnection m_dbConnection;
                List <string>    lstServerResults = new List <string>();
                ProbeDetails     objProbeDetails  = new ProbeDetails();

                //DB Details
                m_dbConnection = new SQLiteConnection(@"Data Source=" + ConfigurationManager.AppSettings["LocalDB_DS"] + ";Version=3;");
                m_dbConnection.Open();
                string sql = "";

                sql = @"select distinct Hostname from Diagnostics_MasterData where probetype='" + ProbeType + "'";


                SQLiteCommand    command = new SQLiteCommand(sql, m_dbConnection);
                SQLiteDataReader reader  = command.ExecuteReader();
                while (reader.Read())
                {
                    lstServerResults.Add(reader["Hostname"].ToString());
                    //Console.WriteLine("Id: " + reader["Id"] + "\tProbeGroup: " + reader["ProbeGroup"] + "\tProbeName: " + reader["ProbeName"] + "\tHostName: " + reader["HostName"]);
                }

                reader.Close();
                m_dbConnection.Close();
                return(lstServerResults);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public static List <ProbeDetails> SelectData(string ServerName)
        {
            try
            {
                SQLiteConnection    m_dbConnection;
                List <ProbeDetails> lstProbeResults = new List <ProbeDetails>();
                ProbeDetails        objProbeDetails = new ProbeDetails();

                //DB Details
                m_dbConnection = new SQLiteConnection(@"Data Source=" + ConfigurationManager.AppSettings["LocalDB_DS"] + ";Version=3;");
                m_dbConnection.Open();
                string           sql     = @"select * from Diagnostics_MasterData where HostName = '" + ServerName + "'";
                SQLiteCommand    command = new SQLiteCommand(sql, m_dbConnection);
                SQLiteDataReader reader  = command.ExecuteReader();
                while (reader.Read())
                {
                    objProbeDetails.HostName   = reader["HostName"].ToString();
                    objProbeDetails.ProbeGroup = reader["ProbeGroup"].ToString();
                    objProbeDetails.ProbeName  = reader["ProbeName"].ToString();
                    objProbeDetails.ProbeType  = reader["ProbeType"].ToString();
                    lstProbeResults.Add(objProbeDetails);
                    //Console.WriteLine("Id: " + reader["Id"] + "\tProbeGroup: " + reader["ProbeGroup"] + "\tProbeName: " + reader["ProbeName"] + "\tHostName: " + reader["HostName"]);
                }

                reader.Close();
                m_dbConnection.Close();
                return(lstProbeResults);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        public static List <string> FetchMetrics(string MetricsType)
        {
            try
            {
                SQLiteConnection m_dbConnection;
                List <string>    lstMetricsResults = new List <string>();
                ProbeDetails     objProbeDetails   = new ProbeDetails();

                //DB Details
                m_dbConnection = new SQLiteConnection(@"Data Source=" + ConfigurationManager.AppSettings["LocalDB_DS"] + ";Version=3;");
                m_dbConnection.Open();
                string sql = string.Empty;
                switch (MetricsType)
                {
                case "Java":
                    sql = @"select MetricsName from Diagnostics_JavaMetrics";
                    break;

                case "Oracle":
                    sql = @"select MetricsName from Diagnostics_OracleMetrics";
                    break;

                case "MQ":
                    sql = @"select MetricsName from Diagnostics_MQMetrics";
                    break;

                default:

                    break;
                }

                SQLiteCommand    command = new SQLiteCommand(sql, m_dbConnection);
                SQLiteDataReader reader  = command.ExecuteReader();
                while (reader.Read())
                {
                    lstMetricsResults.Add(reader["MetricsName"].ToString());
                    //Console.WriteLine("Id: " + reader["Id"] + "\tProbeGroup: " + reader["ProbeGroup"] + "\tProbeName: " + reader["ProbeName"] + "\tHostName: " + reader["HostName"]);
                }

                reader.Close();
                m_dbConnection.Close();

                return(lstMetricsResults);
            }
            catch (Exception)
            {
                throw;
            }
        }