Exemplo n.º 1
0
 public void AddAvgCpuPct(AvgCPUPct pct)
 {
     if (!AvgCpuPcts.ContainsKey(pct.NodeName))
     {
         AvgCpuPcts.Add(pct.NodeName, new SortedSet <AvgCPUPct>());
     }
     AvgCpuPcts[pct.NodeName].Add(pct);
 }
Exemplo n.º 2
0
        public static AzureOverview Get(string azureLabel, DateTime startTime, DateTime endTime)
        {
            AzureOverview overview = new AzureOverview(azureLabel, startTime, endTime);

            Console.WriteLine(" ---- NODE DB BREAKDOWN ---- ");
            // Node / DB Breakdown
            AzurePayload requestPayload = new AzurePayload()
            {
                DB  = "sqlazure1",
                CSL = GetNodeDBBreakdownCSL(azureLabel)
            };
            AzureResponse response = AzureRequester.PostRequest(requestPayload);

            // find useful info
            AzureResponseTable azureTable = response.Tables.Find(table => table.Columns.Exists(column => column.ColumnName.Equals("database_name")));

            foreach (List <dynamic> row in azureTable.Rows)
            {
                DBNode breakdown = new DBNode((string)row[0], (string)row[1], (string)row[2], (string)row[3], (string)row[4], (string)row[5]);
                overview.DBNodes.Add(breakdown);
            }

            Console.WriteLine(" ---- Average CPU % Per Pool Node ---- ");
            // Average CPU % per Pool Node
            requestPayload.CSL = GetPerNodeCSL(azureLabel, startTime, endTime, "avg_cpu_percent");
            response           = AzureRequester.PostRequest(requestPayload);

            // find useful info
            azureTable = response.Tables.Find(table => table.Columns.Exists(column => column.ColumnName.Equals("avg_cpu_percent")));
            foreach (List <dynamic> row in azureTable.Rows)
            {
                AvgCPUPct cpuPct = new AvgCPUPct((DateTime)row[0], (string)row[1], (string)row[2], (string)row[3], (double)row[4]);
                overview.AddAvgCpuPct(cpuPct);
            }

            Console.WriteLine(" ---- Peak Worker % per Pool Node ---- ");
            // Peak Worker % per Pool Node
            requestPayload.CSL = GetPerNodeCSL(azureLabel, startTime, endTime, "peak_worker_percent");
            response           = AzureRequester.PostRequest(requestPayload);

            // find useful info
            azureTable = response.Tables.Find(table => table.Columns.Exists(column => column.ColumnName.Equals("peak_worker_percent")));
            foreach (List <dynamic> row in azureTable.Rows)
            {
                PeakWorkPct peakPct = new PeakWorkPct((DateTime)row[0], (string)row[1], (string)row[2], (string)row[3], (double)row[4]);
                overview.AddPeakWorkerPct(peakPct);
            }

            return(overview);
        }