コード例 #1
0
        private void BindData()
        {
            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(ddl_Server.SelectedValue))
            {
                cloud.R_HostInfo(Lib.Util.TConverter <int>(ddl_Server.SelectedValue));
                dt = cloud.dsReturn.Tables[0];
                gv_Info.DataSource = dt;
                gv_Info.DataBind();

                cloud.W_SQLConfiguration(Lib.Util.TConverter <int>(ddl_Server.SelectedValue));
                gv_Config.DataSource = cloud.dsReturn.Tables[0];
                gv_Config.DataBind();
            }
        }
コード例 #2
0
        private void BindData()
        {
            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(ddl_Server.SelectedValue))
            {
                cloud.R_HostInfo(Lib.Util.TConverter <int>(ddl_Server.SelectedValue));
                dt = cloud.dsReturn.Tables[0];
                gv_Info.DataSource = dt;
                gv_Info.DataBind();
            }

            //각 차트에서 참조해서 사용할 공통 데이터 테이블 생성
            cloud.R_Adhoc("select TimeIn_UTC, Data_JSON from tbPerfmonValues_JSON where Timein_UTC >= '" + dtmStart.ToString("yyyy-MM-dd HH:mm:ss") + "' and Timein_UTC < '" + dtmEnd.ToString("yyyy-MM-dd HH:mm:ss") + "' and ServerNum = " + ServerNum);

            //신규추가 2017-09-23
            if (cloud.dsReturn.Tables[0].Rows.Count > 0)
            {
                //데이터 테이블 구조생성용으로 첫번째 json데이터를 불러와서 컬럼명을 자동셋팅하도록
                DataTable tester = (DataTable)JsonConvert.DeserializeObject(((string)cloud.dsReturn.Tables[0].Rows[0]["Data_Json"]), (typeof(DataTable)));
                //tester 에는 실제로 데이터가 들어가잇고 clone 을 이용해 dt_Struct 에 데이터테이블 구조만 복사
                //DataTable dt_struct = new DataTable();
                dt_PerfmonValue = tester.Clone();
                dt_PerfmonValue.AcceptChanges();
                // 이후 dt_struct 에 계속 merge (union) 하여 하나로 합체 테스트로 돌려보니 rowcount 8만 정도 나왓네요
                foreach (DataRow dr in cloud.dsReturn.Tables[0].Rows)
                {
                    DataTable dt_tmp = (DataTable)JsonConvert.DeserializeObject(((string)dr["Data_Json"]), (typeof(DataTable)));

                    //신규추가 2017-09-23 데이터 머지 = mssql union
                    //신규추가 2017-09-23 참조 https://msdn.microsoft.com/ko-kr/library/fk68ew7b(v=vs.110).aspx
                    dt_PerfmonValue.Merge(dt_tmp);
                }
            }

            {
                //dt_CPU 데이터 테이블 만들기
                var PCIDs = new[] { "P139", "P004", "P107", "P108", "P106", "P184" };

                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where PCIDs.Contains(r.Field <string>("PCID")) ||
                           (r.Field <string>("PCID") == "P001" && r.Field <string>("InstanceName") == "_Total")

                           select r;

                dt_CPU = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_CPU.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_CPU.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_SQL = Lib.ConvertingProc.Pivot(dt_SQL, "Instancename", "TimeIn", "PValue");
                dt_CPU = Func_SetColumn(dt_CPU);
            }


            //실행 쿼리 데이터 읽어오기
            cloud.R_Adhoc("select TimeIn_UTC, Data_JSON from tbSQLCurrentExecution_JSON where Timein_UTC >= '" + dtmStart.ToString("yyyy-MM-dd HH:mm:ss") + "' and Timein_UTC < '" + dtmEnd.ToString("yyyy-MM-dd HH:mm:ss") + "' and ServerNum = " + ServerNum);

            //신규추가 2017-09-23
            if (cloud.dsReturn.Tables[0].Rows.Count > 0)
            {
                //데이터 테이블 구조생성용으로 첫번째 json데이터를 불러와서 컬럼명을 자동셋팅하도록
                DataTable tester = (DataTable)JsonConvert.DeserializeObject(((string)cloud.dsReturn.Tables[0].Rows[0]["Data_Json"]), (typeof(DataTable)));
                //tester 에는 실제로 데이터가 들어가잇고 clone 을 이용해 dt_Struct 에 데이터테이블 구조만 복사
                //DataTable dt_struct = new DataTable();
                dt_SQLQuery = tester.Clone();
                dt_SQLQuery.AcceptChanges();
                // 이후 dt_struct 에 계속 merge (union) 하여 하나로 합체 테스트로 돌려보니 rowcount 8만 정도 나왓네요
                foreach (DataRow dr in cloud.dsReturn.Tables[0].Rows)
                {
                    DataTable dt_tmp = (DataTable)JsonConvert.DeserializeObject(((string)dr["Data_Json"]), (typeof(DataTable)));

                    //신규추가 2017-09-23 데이터 머지 = mssql union
                    //신규추가 2017-09-23 참조 https://msdn.microsoft.com/ko-kr/library/fk68ew7b(v=vs.110).aspx
                    dt_SQLQuery.Merge(dt_tmp);
                }
            }

            {
                //dt_SQLCurrentQuery 데이터 테이블 만들기
                var test = (from r in dt_SQLQuery.AsEnumerable()
                            orderby r.Field <Int64>("cpu_time") descending

                            select r).Take(20);

                dt_SQLCurrentQuery = dt_SQLQuery.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_SQLCurrentQuery.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_SQLCurrentQuery.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                gv_List_Query.DataSource = dt_SQLCurrentQuery;
                gv_List_Query.DataBind();
            }



            //챠트바인드
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst           = SetChartProperty();
            cplst           = Lib.Flotr2.SetArrayString_Line_DualYAxis(dt_CPU, cplst);
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_CPU, cplst);
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }
コード例 #3
0
        private void BindData()
        {
            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(ddl_Server.SelectedValue))
            {
                cloud.R_HostInfo(Lib.Util.TConverter <int>(ddl_Server.SelectedValue));
                dt = cloud.dsReturn.Tables[0];
                gv_Info.DataSource = dt;
                gv_Info.DataBind();
            }

            //각 차트에서 참조해서 사용할 공통 데이터 테이블 생성
            cloud.R_Adhoc("select TimeIn_UTC, Data_JSON from tbPerfmonValues_JSON where Timein_UTC >= '" + dtmStart.ToString("yyyy-MM-dd HH:mm:ss") + "' and Timein_UTC < '" + dtmEnd.ToString("yyyy-MM-dd HH:mm:ss") + "' and ServerNum = " + ServerNum);

            //신규추가 2017-09-23
            if (cloud.dsReturn.Tables[0].Rows.Count > 0)
            {
                //데이터 테이블 구조생성용으로 첫번째 json데이터를 불러와서 컬럼명을 자동셋팅하도록
                DataTable tester = (DataTable)JsonConvert.DeserializeObject(((string)cloud.dsReturn.Tables[0].Rows[0]["Data_Json"]), (typeof(DataTable)));
                //tester 에는 실제로 데이터가 들어가잇고 clone 을 이용해 dt_Struct 에 데이터테이블 구조만 복사
                //DataTable dt_struct = new DataTable();
                dt_PerfmonValue = tester.Clone();
                dt_PerfmonValue.AcceptChanges();
                // 이후 dt_struct 에 계속 merge (union) 하여 하나로 합체 테스트로 돌려보니 rowcount 8만 정도 나왓네요
                foreach (DataRow dr in cloud.dsReturn.Tables[0].Rows)
                {
                    DataTable dt_tmp = (DataTable)JsonConvert.DeserializeObject(((string)dr["Data_Json"]), (typeof(DataTable)));

                    //신규추가 2017-09-23 데이터 머지 = mssql union
                    //신규추가 2017-09-23 참조 https://msdn.microsoft.com/ko-kr/library/fk68ew7b(v=vs.110).aspx
                    dt_PerfmonValue.Merge(dt_tmp);
                }
            }

            {
                //dt_SQLDATA 데이터 테이블 만들기
                var PCIDs = new[] { "P007", "P081", "P138", "P084", "P098"
                                    , "P008", "P168", "P176", "P177", "P102"
                                    , "P178", "P179", "P103", "P104", "P105"
                                    , "P180", "P181", "P182", "P183", "P100"
                                    , "P101" };

                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where PCIDs.Contains(r.Field <string>("PCID"))

                           select r;

                dt_SQLData = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_SQLData.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_SQLData.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_SQLData = Func_SetColumn(dt_SQLData);
            }

            //챠트바인드
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst           = SetChartProperty();
            cplst           = Lib.Flotr2.SetArrayString_Line_DualYAxis(dt_SQLData, cplst);
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_SQLData, cplst);
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }
コード例 #4
0
        private void BindData()
        {
            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(ddl_Server.SelectedValue))
            {
                cloud.R_HostInfo(Lib.Util.TConverter <int>(ddl_Server.SelectedValue));
                dt = cloud.dsReturn.Tables[0];
                gv_Info.DataSource = dt;
                gv_Info.DataBind();
            }
            int numDuration = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ChartDataDuration"]);

            //각 차트에서 참조해서 사용할 공통 데이터 테이블 생성
            cloud.R_Adhoc("select TimeIn_UTC, Data_JSON from tbPerfmonValues_JSON where Timein_UTC >= '" + dtmStart.ToString("yyyy-MM-dd HH:mm:ss") + "' and Timein_UTC < '" + dtmEnd.ToString("yyyy-MM-dd HH:mm:ss") + "' and ServerNum = " + ServerNum);

            //신규추가 2017-09-23
            if (cloud.dsReturn.Tables[0].Rows.Count > 0)
            {
                //데이터 테이블 구조생성용으로 첫번째 json데이터를 불러와서 컬럼명을 자동셋팅하도록
                DataTable tester = (DataTable)JsonConvert.DeserializeObject(((string)cloud.dsReturn.Tables[0].Rows[0]["Data_Json"]), (typeof(DataTable)));
                //tester 에는 실제로 데이터가 들어가잇고 clone 을 이용해 dt_Struct 에 데이터테이블 구조만 복사
                //DataTable dt_struct = new DataTable();
                dt_PerfmonValue = tester.Clone();
                dt_PerfmonValue.AcceptChanges();
                // 이후 dt_struct 에 계속 merge (union) 하여 하나로 합체 테스트로 돌려보니 rowcount 8만 정도 나왓네요
                foreach (DataRow dr in cloud.dsReturn.Tables[0].Rows)
                {
                    DataTable dt_tmp = (DataTable)JsonConvert.DeserializeObject(((string)dr["Data_Json"]), (typeof(DataTable)));

                    //신규추가 2017-09-23 데이터 머지 = mssql union
                    //신규추가 2017-09-23 참조 https://msdn.microsoft.com/ko-kr/library/fk68ew7b(v=vs.110).aspx
                    dt_PerfmonValue.Merge(dt_tmp);
                }
            }


            {
                //dt_Avgwaintime 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P129"
                           select r;

                dt_Avgwaintime = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_Avgwaintime.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_Avgwaintime.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_Avgwaintime        = Lib.ConvertingProc.Pivot(dt_Avgwaintime, "Instancename", "TimeIn", "Pvalue");
                strColumn_AVGWAITTIME = Lib.ConvertingProc.GetColumname(dt_Avgwaintime.Columns);
            }


            {
                //dt_LockRequest 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P130"
                           select r;

                dt_LockRequest = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LockRequest.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LockRequest.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LockRequest        = Lib.ConvertingProc.Pivot(dt_LockRequest, "Instancename", "TimeIn", "Pvalue");
                strColumn_LockRequest = Lib.ConvertingProc.GetColumname(dt_LockRequest.Columns);
            }


            {
                //dt_LockTimeoutTimeout 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P199"
                           select r;

                dt_LockTimeoutTimeout = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LockTimeoutTimeout.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LockTimeoutTimeout.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LockTimeoutTimeout        = Lib.ConvertingProc.Pivot(dt_LockTimeoutTimeout, "Instancename", "TimeIn", "Pvalue");
                strColumn_LockTimeOutTimeOut = Lib.ConvertingProc.GetColumname(dt_LockTimeoutTimeout.Columns);
            }

            {
                //dt_LockTimeout 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P131"
                           select r;

                dt_LockTimeout = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LockTimeout.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LockTimeout.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LockTimeout        = Lib.ConvertingProc.Pivot(dt_LockTimeout, "Instancename", "TimeIn", "Pvalue");
                strColumn_LockTimeOut = Lib.ConvertingProc.GetColumname(dt_LockTimeout.Columns);
            }

            {
                //dt_LockWaitTimeMs 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P132"
                           select r;

                dt_LockWaitTimeMs = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LockWaitTimeMs.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LockWaitTimeMs.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LockWaitTimeMs        = Lib.ConvertingProc.Pivot(dt_LockWaitTimeMs, "Instancename", "TimeIn", "Pvalue");
                strColumn_LockWaitTimeMs = Lib.ConvertingProc.GetColumname(dt_LockWaitTimeMs.Columns);
            }

            {
                //dt_LockWaitTimeSec 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P133"
                           select r;

                dt_LockWaitTimeSec = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LockWaitTimeSec.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LockWaitTimeSec.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LockWaitTimeSec    = Lib.ConvertingProc.Pivot(dt_LockWaitTimeSec, "Instancename", "TimeIn", "Pvalue");
                strColumn_LockWaitSec = Lib.ConvertingProc.GetColumname(dt_LockWaitTimeSec.Columns);
            }


            {
                //dt_NumberofDeadlock 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P134"
                           select r;

                dt_NumberofDeadlock = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_NumberofDeadlock.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_NumberofDeadlock.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_NumberofDeadlock        = Lib.ConvertingProc.Pivot(dt_NumberofDeadlock, "Instancename", "TimeIn", "Pvalue");
                strColumn_NumberofDeadlock = Lib.ConvertingProc.GetColumname(dt_NumberofDeadlock.Columns);
            }


            //챠트바인드
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst           = SetChartProperty();
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_Avgwaintime, cplst, "AVGWAITTIME_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LockRequest, cplst, "LOCKREQUESTS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LockTimeoutTimeout, cplst, "LOCKTIMEOUTSTIMEOUT_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LockTimeout, cplst, "LOCKTIMEOUTS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LockWaitTimeMs, cplst, "LOCKWAITTIMEMS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LockWaitTimeSec, cplst, "LOCKWAITSEC_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_NumberofDeadlock, cplst, "NUMBEROFDEADLOCKS_LINE_CHART");
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }
コード例 #5
0
        private void BindData()
        {
            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(ddl_Server.SelectedValue))
            {
                cloud.R_HostInfo(Lib.Util.TConverter <int>(ddl_Server.SelectedValue));
                dt = cloud.dsReturn.Tables[0];
                gv_Info.DataSource = dt;
                gv_Info.DataBind();
            }

            //각 차트에서 참조해서 사용할 공통 데이터 테이블 생성
            cloud.R_Adhoc("select TimeIn_UTC, Data_JSON from tbPerfmonValues_JSON where Timein_UTC >= '" + dtmStart.ToString("yyyy-MM-dd HH:mm:ss") + "' and Timein_UTC < '" + dtmEnd.ToString("yyyy-MM-dd HH:mm:ss") + "' and ServerNum = " + ServerNum);

            //신규추가 2017-09-23
            if (cloud.dsReturn.Tables[0].Rows.Count > 0)
            {
                //데이터 테이블 구조생성용으로 첫번째 json데이터를 불러와서 컬럼명을 자동셋팅하도록
                DataTable tester = (DataTable)JsonConvert.DeserializeObject(((string)cloud.dsReturn.Tables[0].Rows[0]["Data_Json"]), (typeof(DataTable)));
                //tester 에는 실제로 데이터가 들어가잇고 clone 을 이용해 dt_Struct 에 데이터테이블 구조만 복사
                //DataTable dt_struct = new DataTable();
                dt_PerfmonValue = tester.Clone();
                dt_PerfmonValue.AcceptChanges();
                // 이후 dt_struct 에 계속 merge (union) 하여 하나로 합체 테스트로 돌려보니 rowcount 8만 정도 나왓네요
                foreach (DataRow dr in cloud.dsReturn.Tables[0].Rows)
                {
                    DataTable dt_tmp = (DataTable)JsonConvert.DeserializeObject(((string)dr["Data_Json"]), (typeof(DataTable)));

                    //신규추가 2017-09-23 데이터 머지 = mssql union
                    //신규추가 2017-09-23 참조 https://msdn.microsoft.com/ko-kr/library/fk68ew7b(v=vs.110).aspx
                    dt_PerfmonValue.Merge(dt_tmp);
                }
            }

            {
                //dt_FreeSpace_per 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P164"
                           select r;

                dt_FreeSpace_per = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_FreeSpace_per.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_FreeSpace_per.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_FreeSpace_per = Lib.ConvertingProc.SetDiskProc(dt_FreeSpace_per);
                dt_FreeSpace_per          = Lib.ConvertingProc.Pivot(dt_FreeSpace_per, "Instancename", "TimeIn", "Pvalue");
                strColumnName_FreeDiskPer = Lib.ConvertingProc.GetColumname(dt_FreeSpace_per.Columns);
            }

            {
                //dt_FreeSpace_byte 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P018"
                           select r;

                dt_FreeSpace_byte = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_FreeSpace_byte.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_FreeSpace_byte.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_FreeSpace_byte = Lib.ConvertingProc.SetDiskProc(dt_FreeSpace_byte);
                dt_FreeSpace_byte          = Lib.ConvertingProc.Pivot(dt_FreeSpace_byte, "Instancename", "TimeIn", "Pvalue");
                strColumnName_FreeDiskByte = Lib.ConvertingProc.GetColumname(dt_FreeSpace_byte.Columns);
            }

            {
                //dt_DiskTime 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P015"
                           select r;

                dt_DiskTime = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_DiskTime.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_DiskTime.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_DiskTime = Lib.ConvertingProc.SetDiskProc(dt_DiskTime);
                dt_DiskTime           = Lib.ConvertingProc.Pivot(dt_DiskTime, "Instancename", "TimeIn", "Pvalue");
                strColumName_DiskTime = Lib.ConvertingProc.GetColumname(dt_DiskTime.Columns);
            }

            {
                //dt_DiskIdleTime 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P190"
                           select r;

                dt_DiskIdleTime = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_DiskIdleTime.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_DiskIdleTime.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_DiskIdleTime = Lib.ConvertingProc.SetDiskProc(dt_DiskIdleTime);
                dt_DiskIdleTime           = Lib.ConvertingProc.Pivot(dt_DiskIdleTime, "Instancename", "TimeIn", "Pvalue");
                strColumName_DiskIdleTime = Lib.ConvertingProc.GetColumname(dt_DiskIdleTime.Columns);
            }

            {
                //dt_AvgDiskRead 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P191"
                           select r;

                dt_AvgDiskRead = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_AvgDiskRead.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_AvgDiskRead.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_AvgDiskRead = Lib.ConvertingProc.SetDiskProc(dt_AvgDiskRead);
                dt_AvgDiskRead          = Lib.ConvertingProc.Pivot(dt_AvgDiskRead, "Instancename", "TimeIn", "Pvalue");
                strColumName_AvDiskRead = Lib.ConvertingProc.GetColumname(dt_AvgDiskRead.Columns);
            }


            {
                //dt_AvgDiskWrite 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P193"
                           select r;

                dt_AvgDiskWrite = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_AvgDiskWrite.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_AvgDiskWrite.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_AvgDiskWrite = Lib.ConvertingProc.SetDiskProc(dt_AvgDiskWrite);
                dt_AvgDiskWrite           = Lib.ConvertingProc.Pivot(dt_AvgDiskWrite, "Instancename", "TimeIn", "Pvalue");
                strColumName_AvgDiskWrite = Lib.ConvertingProc.GetColumname(dt_AvgDiskWrite.Columns);
            }

            {
                //dt_AvgDiskReadQueue 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P197"
                           select r;

                dt_AvgDiskReadQueue = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_AvgDiskReadQueue.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_AvgDiskReadQueue.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_AvgDiskReadQueue = Lib.ConvertingProc.SetDiskProc(dt_AvgDiskReadQueue);
                dt_AvgDiskReadQueue = Lib.ConvertingProc.Pivot(dt_AvgDiskReadQueue, "Instancename", "TimeIn", "Pvalue");
                strColumName_AvgDiskReadQueueLength = Lib.ConvertingProc.GetColumname(dt_AvgDiskReadQueue.Columns);
            }

            {
                //dt_AvgDiskWriteQueue 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P198"
                           select r;

                dt_AvgDiskWriteQueue = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_AvgDiskWriteQueue.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_AvgDiskWriteQueue.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_AvgDiskWriteQueue = Lib.ConvertingProc.SetDiskProc(dt_AvgDiskWriteQueue);
                dt_AvgDiskWriteQueue = Lib.ConvertingProc.Pivot(dt_AvgDiskWriteQueue, "Instancename", "TimeIn", "Pvalue");
                strColumName_AvgDiskWriteQueueLength = Lib.ConvertingProc.GetColumname(dt_AvgDiskWriteQueue.Columns);
            }


            {
                //dt_AvgDiskQueue 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P017"
                           select r;

                dt_AvgDiskQueue = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_AvgDiskQueue.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_AvgDiskQueue.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_AvgDiskQueue = Lib.ConvertingProc.SetDiskProc(dt_AvgDiskQueue);
                dt_AvgDiskQueue = Lib.ConvertingProc.Pivot(dt_AvgDiskQueue, "Instancename", "TimeIn", "Pvalue");
                strColumnName_AvgDiskQueueLength = Lib.ConvertingProc.GetColumname(dt_AvgDiskQueue.Columns);
            }

            {
                //dt_CurruntQueue 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P194"
                           select r;

                dt_CurruntQueue = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_CurruntQueue.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_CurruntQueue.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                //dt_CurruntQueue = Lib.ConvertingProc.SetDiskProc(dt_CurruntQueue);
                dt_CurruntQueue = Lib.ConvertingProc.Pivot(dt_CurruntQueue, "Instancename", "TimeIn", "Pvalue");
                strColumnName_CurrentDiskQueueLength = Lib.ConvertingProc.GetColumname(dt_CurruntQueue.Columns);
            }


            //챠트바인드
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst           = SetChartProperty();
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_FreeSpace_per, cplst, "FREEDISKSPACEPER_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_FreeSpace_byte, cplst, "FREEDISKSPACEMB_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_DiskTime, cplst, "DISKTIMEMS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_DiskIdleTime, cplst, "DISKIDLETIME_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_AvgDiskRead, cplst, "AVGDISKREAD_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_AvgDiskWrite, cplst, "AVGDISKWRITE_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_AvgDiskReadQueue, cplst, "AVGDISKREADQUEUE_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_AvgDiskWriteQueue, cplst, "AVGDISKWRITEQUEUE_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_AvgDiskQueue, cplst, "AVGDISKQUEUE_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_CurruntQueue, cplst, "CURRENTDISKQUEUE_LINE_CHART");
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }
コード例 #6
0
        private void BindData()
        {
            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(ddl_Server.SelectedValue))
            {
                cloud.R_HostInfo(Lib.Util.TConverter <int>(ddl_Server.SelectedValue));
                dt = cloud.dsReturn.Tables[0];
                gv_Info.DataSource = dt;
                gv_Info.DataBind();

                cloud.w_SQLDatabasesDetail(Lib.Util.TConverter <int>(ddl_Server.SelectedValue));
                gv_List.DataSource = cloud.dsReturn.Tables[0];
                gv_List.DataBind();
            }
            int numDuration = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ChartDataDuration"]);

            //각 차트에서 참조해서 사용할 공통 데이터 테이블 생성
            cloud.R_Adhoc("select TimeIn_UTC, Data_JSON from tbPerfmonValues_JSON where Timein_UTC >= '" + dtmStart.ToString("yyyy-MM-dd HH:mm:ss") + "' and Timein_UTC < '" + dtmEnd.ToString("yyyy-MM-dd HH:mm:ss") + "' and ServerNum = " + ServerNum);

            //신규추가 2017-09-23
            if (cloud.dsReturn.Tables[0].Rows.Count > 0)
            {
                //데이터 테이블 구조생성용으로 첫번째 json데이터를 불러와서 컬럼명을 자동셋팅하도록
                DataTable tester = (DataTable)JsonConvert.DeserializeObject(((string)cloud.dsReturn.Tables[0].Rows[0]["Data_Json"]), (typeof(DataTable)));
                //tester 에는 실제로 데이터가 들어가잇고 clone 을 이용해 dt_Struct 에 데이터테이블 구조만 복사
                //DataTable dt_struct = new DataTable();
                dt_PerfmonValue = tester.Clone();
                dt_PerfmonValue.AcceptChanges();
                // 이후 dt_struct 에 계속 merge (union) 하여 하나로 합체 테스트로 돌려보니 rowcount 8만 정도 나왓네요
                foreach (DataRow dr in cloud.dsReturn.Tables[0].Rows)
                {
                    DataTable dt_tmp = (DataTable)JsonConvert.DeserializeObject(((string)dr["Data_Json"]), (typeof(DataTable)));

                    //신규추가 2017-09-23 데이터 머지 = mssql union
                    //신규추가 2017-09-23 참조 https://msdn.microsoft.com/ko-kr/library/fk68ew7b(v=vs.110).aspx
                    dt_PerfmonValue.Merge(dt_tmp);
                }
            }

            {
                //dt_ACTIVETRANSACTIONS 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P114"
                           select r;

                dt_ACTIVETRANSACTIONS = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_ACTIVETRANSACTIONS.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_ACTIVETRANSACTIONS.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_ACTIVETRANSACTIONS        = Lib.ConvertingProc.Pivot(dt_ACTIVETRANSACTIONS, "Instancename", "TimeIn", "Pvalue");
                strColumn_ACTIVETRANSACTIONS = Lib.ConvertingProc.GetColumname(dt_ACTIVETRANSACTIONS.Columns);
            }

            {
                //dt_LOGCACHEHITRATIO 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P169"
                           select r;

                dt_LOGCACHEHITRATIO = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LOGCACHEHITRATIO.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LOGCACHEHITRATIO.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LOGCACHEHITRATIO        = Lib.ConvertingProc.Pivot(dt_LOGCACHEHITRATIO, "Instancename", "TimeIn", "Pvalue");
                strColumn_LOGCACHEHITRATIO = Lib.ConvertingProc.GetColumname(dt_LOGCACHEHITRATIO.Columns);
            }

            {
                //dt_LOGCACHEHITRATIO 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P120"
                           select r;

                dt_LOGBYTESFLUSHEDSEC = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LOGBYTESFLUSHEDSEC.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LOGBYTESFLUSHEDSEC.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LOGBYTESFLUSHEDSEC        = Lib.ConvertingProc.Pivot(dt_LOGBYTESFLUSHEDSEC, "Instancename", "TimeIn", "Pvalue");
                strColumn_LOGBYTESFLUSHEDSEC = Lib.ConvertingProc.GetColumname(dt_LOGBYTESFLUSHEDSEC.Columns);
            }

            {
                //dt_LOGFLUSHWAITTIME 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P121"
                           select r;

                dt_LOGFLUSHWAITTIME = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LOGFLUSHWAITTIME.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LOGFLUSHWAITTIME.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LOGFLUSHWAITTIME        = Lib.ConvertingProc.Pivot(dt_LOGFLUSHWAITTIME, "Instancename", "TimeIn", "Pvalue");
                strColumn_LOGFLUSHWAITTIME = Lib.ConvertingProc.GetColumname(dt_LOGFLUSHWAITTIME.Columns);
            }


            {
                //dt_LOGFLUSHWAITTIME 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P118"
                           select r;

                dt_LOGFLUSHWAITSSEC = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LOGFLUSHWAITSSEC.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LOGFLUSHWAITSSEC.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LOGFLUSHWAITSSEC        = Lib.ConvertingProc.Pivot(dt_LOGFLUSHWAITSSEC, "Instancename", "TimeIn", "Pvalue");
                strColumn_LOGFLUSHWAITSSEC = Lib.ConvertingProc.GetColumname(dt_LOGFLUSHWAITSSEC.Columns);
            }

            {
                //dt_LOGFLUSHESSEC 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P119"
                           select r;

                dt_LOGFLUSHESSEC = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LOGFLUSHESSEC.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LOGFLUSHESSEC.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LOGFLUSHESSEC        = Lib.ConvertingProc.Pivot(dt_LOGFLUSHESSEC, "Instancename", "TimeIn", "Pvalue");
                strColumn_LOGFLUSHESSEC = Lib.ConvertingProc.GetColumname(dt_LOGFLUSHESSEC.Columns);
            }

            {
                //dt_LOGGROWTHS 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P122"
                           select r;

                dt_LOGGROWTHS = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LOGGROWTHS.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LOGGROWTHS.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LOGGROWTHS        = Lib.ConvertingProc.Pivot(dt_LOGGROWTHS, "Instancename", "TimeIn", "Pvalue");
                strColumn_LOGGROWTHS = Lib.ConvertingProc.GetColumname(dt_LOGGROWTHS.Columns);
            }

            {
                //dt_LOGSHRINKS 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P123"
                           select r;

                dt_LOGSHRINKS = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LOGSHRINKS.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LOGSHRINKS.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LOGSHRINKS        = Lib.ConvertingProc.Pivot(dt_LOGSHRINKS, "Instancename", "TimeIn", "Pvalue");
                strColumn_LOGSHRINKS = Lib.ConvertingProc.GetColumname(dt_LOGSHRINKS.Columns);
            }

            {
                //dt_LOGSHRINKS 데이터 테이블 만들기
                var test = from r in dt_PerfmonValue.AsEnumerable()
                           where r.Field <string>("PCID") == "P124"
                           select r;

                dt_LOGTRUNCATIONS = dt_PerfmonValue.Clone();

                foreach (DataRow r in test)
                {
                    var newRow = dt_LOGTRUNCATIONS.NewRow();
                    newRow.ItemArray = r.ItemArray;
                    dt_LOGTRUNCATIONS.Rows.Add(newRow);//I'm doubtful if you need to call this or not
                }

                dt_LOGTRUNCATIONS        = Lib.ConvertingProc.Pivot(dt_LOGTRUNCATIONS, "Instancename", "TimeIn", "Pvalue");
                strColumn_LOGTRUNCATIONS = Lib.ConvertingProc.GetColumname(dt_LOGTRUNCATIONS.Columns);
            }


            //챠트바인드
            List <Lib.chartProperty> cplst = new List <Lib.chartProperty>();
            StringBuilder            sb    = new StringBuilder();

            cplst           = SetChartProperty();
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_ACTIVETRANSACTIONS, cplst, "ACTIVETRANSACTIONS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LOGCACHEHITRATIO, cplst, "LOGCACHEHITRATIO_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LOGBYTESFLUSHEDSEC, cplst, "LOGBYTESFLUSHEDSEC_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LOGFLUSHWAITTIME, cplst, "LOGFLUSHWAITTIME_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LOGFLUSHWAITSSEC, cplst, "LOGFLUSHWAITSSEC_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LOGFLUSHESSEC, cplst, "LOGFLUSHESSEC_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LOGGROWTHS, cplst, "LOGGROWTHS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LOGSHRINKS, cplst, "LOGSHRINKS_LINE_CHART");
            cplst           = Lib.Flotr2.SetArrayString_Lines(dt_LOGTRUNCATIONS, cplst, "LOGTRUNCATIONS_LINE_CHART");
            sb              = Lib.Flotr2.SetStringValue(cplst, sb, ServerNum.ToString());
            litScript.Text += Lib.Util.BoxingScript(sb.ToString());
        }