Exemplo n.º 1
0
        public FarmOverview(string farmLabel, DateTime startTime, DateTime endTime)
        {
            FarmLabel = farmLabel;
            StartTime = startTime;
            EndTime   = endTime;
            // convert to milliseconds from epoch
            long startMillisFromEpoch = (long)StartTime.Subtract(DateTimeUtils.EPOCH_1970).TotalMilliseconds;
            long endMillisFromEpoch   = (long)EndTime.Subtract(DateTimeUtils.EPOCH_1970).TotalMilliseconds;

            Probe = ProbeOverviewRequest.Get(FarmLabel, startMillisFromEpoch, endMillisFromEpoch);
            SQL   = SQLPerfOverviewRequest.Get(FarmLabel, startMillisFromEpoch, endMillisFromEpoch);
            USR   = USRandRPSPerfOverviewRequest.Get(FarmLabel, startMillisFromEpoch, endMillisFromEpoch);
        }
Exemplo n.º 2
0
        public FarmOverview(string farmLabel)
        {
            FarmLabel = farmLabel;
            EndTime   = DateTime.Now;
            StartTime = EndTime.AddHours(-1); // grab 1 hours worth
            // milliseconds from epoch
            long endTime   = (long)DateTime.Now.Subtract(DateTimeUtils.EPOCH_1970).TotalMilliseconds;
            long startTime = endTime - (1000 * 60 * 60);  // grab 1 hours worth

            Probe = ProbeOverviewRequest.Get(FarmLabel, startTime, endTime);
            SQL   = SQLPerfOverviewRequest.Get(FarmLabel, startTime, endTime);
            USR   = USRandRPSPerfOverviewRequest.Get(FarmLabel, startTime, endTime);
        }
Exemplo n.º 3
0
        public static USRandRPSPerfOverview Get(string farmLabel, long startMillisFromEpoch, long endMillisFromEpoch)
        {
            USRandRPSPerfOverview overview = new USRandRPSPerfOverview();

            // USR Processor - % Processor Time for CPU
            FarmPayload requestPayload = new FarmPayload()
            {
                Instance = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        "_Total"
                    }
                },
                DataCenter = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                Environment = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                FarmId = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                FarmLabel = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        farmLabel
                    }
                },
                FarmType = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        "Primary"
                    }
                },
                Machine = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                Network = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[0]
                },
                Role = new PayloadItem()
                {
                    Item1 = false, Item2 = new string[1] {
                        "USR"
                    }
                },
            };
            // USR Processor - % Processor Time for CPU URL
            string processorCPUTimeURL = BuildURL("%255CProcessor(*)%255C%2525%2520Processor%2520Time", "NullableAverage", startMillisFromEpoch, endMillisFromEpoch);

            // Make Post
            JarvisResponse response = JarvisRequester.PostRequest(processorCPUTimeURL, requestPayload);

            startMillisFromEpoch = response.StartTimeUtc; // The jarvis site does some alignment w/ data (like gettin rid of milliseconds, etc.)
            endMillisFromEpoch   = response.EndTimeUtc;
            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions   = eval.DimensionList.Values;
                string           machine      = dimensions.Where(dim => dim.Key.Equals(Dimension.MACHINE)).Single().Value;
                SeriesValues     seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetProcessorTimeCPU(machine, seriesValues);
            }

            // USR Processor - % Processor Time for Requests
            requestPayload.Instance.Item2 = new string[0];

            // USR Processor - % Processor Time for Requests
            string processorTimeRequestsURL = BuildURL("%255CASP%252ENET%255CRequests%2520Current", "Max", startMillisFromEpoch, endMillisFromEpoch);

            // Make Post
            response             = JarvisRequester.PostRequest(processorTimeRequestsURL, requestPayload);
            startMillisFromEpoch = response.StartTimeUtc; // The jarvis site does some alignment w/ data (like gettin rid of milliseconds, etc.)
            endMillisFromEpoch   = response.EndTimeUtc;
            foreach (EvaluatedResult eval in response.Results.Values)
            {
                List <Dimension> dimensions   = eval.DimensionList.Values;
                string           machine      = dimensions.Where(dim => dim.Key.Equals(Dimension.MACHINE)).Single().Value;
                SeriesValues     seriesValues = new SeriesValues()
                {
                    StartTimeMillisUtc     = startMillisFromEpoch,
                    EndTimeMillisUtc       = endMillisFromEpoch,
                    TimeResolutionInMillis = response.TimeResolutionInMilliseconds,
                    Values = eval.Scores.ToArray()
                };
                overview.SetProcessorTimeRequests(machine, seriesValues);
            }

            return(overview);
        }