Package org.jclouds.cloudwatch.domain

Examples of org.jclouds.cloudwatch.domain.GetMetricStatisticsResponse


                                                     .credentials(identity, credential)
                                                     .modules(setupModules())
                                                     .buildApi(CloudWatchApi.class);

         try {
            GetMetricStatisticsResponse datapoints = monitoringApi.getMetricApiForRegion(instance.getRegion())
                     .getMetricStatistics(GetMetricStatistics.builder()
                                                             .dimension(new Dimension(EC2Constants.Dimension.INSTANCE_ID, instance.getId()))
                                                             .unit(Unit.PERCENT)
                                                             .namespace("AWS/EC2")
                                                             .metricName("CPUUtilization")
                                                             .startTime(before)
                                                             .endTime(new Date())
                                                             .period(60)
                                                             .statistic(Statistics.AVERAGE)
                                                             .build());
            assert (datapoints.size() > 0) : instance;
         } finally {
            monitoringApi.close();
         }

         // make sure we made our dummy group and also let in the user's group
View Full Code Here


                                                      .statistic(Statistics.SUM)
                                                      .period(60)
                                                      .startTime(startTime)
                                                      .unit(Unit.COUNT)
                                                      .build();
         GetMetricStatisticsResponse gmr = api().getMetricStatistics(gms);

         Assert.assertEquals(1, Iterables.size(gmr));

         Datapoint datapoint = gmr.iterator().next();

         Assert.assertEquals(datapoint.getTimestamp(), metricTimestampInCloudWatch);
         Assert.assertNull(datapoint.getCustomUnit());
         Assert.assertEquals(Unit.COUNT, datapoint.getUnit());
         Assert.assertNull(datapoint.getAverage());
View Full Code Here

                                                 .period(300)
                                                 .startTime(cal.getTime())
                                                 .statistics(ImmutableSet.of(Statistics.MAXIMUM,
                                                                             Statistics.MINIMUM))
                                                 .unit(Unit.PERCENT).build();
               GetMetricStatisticsResponse response = api().getMetricStatistics(options);

               if (response.size() > 0) {
                  checkNotNull(response.getLabel());

                  for (Datapoint datapoint : response) {
                     checkArgument(datapoint.getAverage() == null);
                     checkNotNull(datapoint.getMaximum());
                     checkNotNull(datapoint.getMinimum());
View Full Code Here

   public GetMetricStatisticsResponseHandlerV2(DatapointHandler DatapointHandler) {
      this.datapointHandler = DatapointHandler;
   }

   public GetMetricStatisticsResponse getResult() {
      return new GetMetricStatisticsResponse(datapoints, label);
   }
View Full Code Here

                                                     .credentials(identity, credential)
                                                     .modules(setupModules())
                                                     .buildApi(CloudWatchApi.class);

         try {
            GetMetricStatisticsResponse datapoints = monitoringApi.getMetricApiForRegion(instance.getRegion())
                     .getMetricStatistics(GetMetricStatistics.builder()
                                                             .dimension(new Dimension(EC2Constants.Dimension.INSTANCE_ID, instance.getId()))
                                                             .unit(Unit.PERCENT)
                                                             .namespace("AWS/EC2")
                                                             .metricName("CPUUtilization")
                                                             .startTime(before)
                                                             .endTime(new Date())
                                                             .period(60)
                                                             .statistic(Statistics.AVERAGE)
                                                             .build());
            assert datapoints.size() > 0 : instance;
         } finally {
            monitoringApi.close();
         }

         // make sure we made our dummy group and also let in the user's group
View Full Code Here

                                                      .statistic(Statistics.SUM)
                                                      .period(60)
                                                      .startTime(startTime)
                                                      .unit(Unit.COUNT)
                                                      .build();
         GetMetricStatisticsResponse gmr = api().getMetricStatistics(gms);

         Assert.assertEquals(1, Iterables.size(gmr));

         Datapoint datapoint = gmr.iterator().next();

         Assert.assertEquals(datapoint.getTimestamp(), metricTimestampInCloudWatch);
         Assert.assertNull(datapoint.getCustomUnit());
         Assert.assertEquals(Unit.COUNT, datapoint.getUnit());
         Assert.assertNull(datapoint.getAverage());
View Full Code Here

                                                 .period(300)
                                                 .startTime(cal.getTime())
                                                 .statistics(ImmutableSet.of(Statistics.MAXIMUM,
                                                                             Statistics.MINIMUM))
                                                 .unit(Unit.PERCENT).build();
               GetMetricStatisticsResponse response = api().getMetricStatistics(options);

               if (response.size() > 0) {
                  checkNotNull(response.getLabel());

                  for (Datapoint datapoint : response) {
                     checkArgument(datapoint.getAverage() == null);
                     checkNotNull(datapoint.getMaximum());
                     checkNotNull(datapoint.getMinimum());
View Full Code Here

                                                          // Specify the metric statistic granularity
                                                          .period(3600)
                                                          // Specify the unit the metric values should be in
                                                          .unit(Unit.PERCENT)
                                                          .build();
      GetMetricStatisticsResponse statisticsResponse = metricClient.getMetricStatistics(statistics);
      double avg = 0d;
      double max = 0d;
      double min = 0d;
      Iterator<Datapoint> datapointIterator = statisticsResponse.iterator();

      while(datapointIterator.hasNext()) {
         Datapoint datapoint = datapointIterator.next();
         Double dAvg = datapoint.getAverage();
         Double dMax = datapoint.getMaximum();
View Full Code Here

                                                     .credentials(identity, credential)
                                                     .modules(setupModules())
                                                     .buildApi(CloudWatchApi.class);

         try {
            GetMetricStatisticsResponse datapoints = monitoringApi.getMetricApiForRegion(instance.getRegion())
                     .getMetricStatistics(GetMetricStatistics.builder()
                                                             .dimension(new Dimension(EC2Constants.Dimension.INSTANCE_ID, instance.getId()))
                                                             .unit(Unit.PERCENT)
                                                             .namespace("AWS/EC2")
                                                             .metricName("CPUUtilization")
                                                             .startTime(before)
                                                             .endTime(new Date())
                                                             .period(60)
                                                             .statistic(Statistics.AVERAGE)
                                                             .build());
            assert (datapoints.size() > 0) : instance;
         } finally {
            monitoringApi.close();
         }

         // make sure we made our dummy group and also let in the user's group
View Full Code Here

   public GetMetricStatisticsResponseHandlerV2(DatapointHandler DatapointHandler) {
      this.datapointHandler = DatapointHandler;
   }

   public GetMetricStatisticsResponse getResult() {
      return new GetMetricStatisticsResponse(datapoints, label);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.cloudwatch.domain.GetMetricStatisticsResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.