Package com.amazonaws.services.cloudwatch

Examples of com.amazonaws.services.cloudwatch.AmazonCloudWatchClient


  private AmazonCloudWatchClient cloudWatchClient;
  private AmazonSQSClient sqsClient;

  public CloudWatchMonitor()
  {
    this.cloudWatchClient = new AmazonCloudWatchClient(new ClasspathPropertiesFileCredentialsProvider());
    this.sqsClient = new AmazonSQSClient(new ClasspathPropertiesFileCredentialsProvider());
    cloudWatchClient.setEndpoint("monitoring.us-west-2.amazonaws.com");
    sqsClient.setEndpoint("sqs.us-west-2.amazonaws.com");
  }
View Full Code Here


     * @param instanceId instance id
     * @return average CPU utilization of the instance
     */
    public static double monitorInstance(AWSCredentials credential, String instanceId) {
        try {
            AmazonCloudWatchClient cw = new AmazonCloudWatchClient(credential) ;

            long offsetInMilliseconds = 1000 * 60 * 60 * 24;
            GetMetricStatisticsRequest request = new GetMetricStatisticsRequest()
                    .withStartTime(new Date(new Date().getTime() - offsetInMilliseconds))
                    .withNamespace("AWS/EC2")
                    .withPeriod(60 * 60)
                    .withDimensions(new Dimension().withName("InstanceId").withValue(instanceId))
                    .withMetricName("CPUUtilization")
                    .withStatistics("Average", "Maximum")
                    .withEndTime(new Date());
            GetMetricStatisticsResult getMetricStatisticsResult = cw.getMetricStatistics(request);

            double avgCPUUtilization = 0;
            List dataPoint = getMetricStatisticsResult.getDatapoints();
            for (Object aDataPoint : dataPoint) {
                Datapoint dp = (Datapoint) aDataPoint;
View Full Code Here

        return cloudWatchClient;
    }

    AmazonCloudWatch createCloudWatchClient() {
        AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey());
        AmazonCloudWatch client = new AmazonCloudWatchClient(credentials);
        return client;
    }
View Full Code Here

      ClientConfiguration clientConfiguration) {
    // limit the time-to-live of the JVM's DNS cache (in seconds)
    java.security.Security.setProperty("networkaddress.cache.ttl", "60");

    this.region = region;
    this.api = new AmazonCloudWatchClient(awsCredentials,
        clientConfiguration);
    String endpoint = "monitoring." + region + ".amazonaws.com";
    this.api.setEndpoint(endpoint);
  }
View Full Code Here

            ExecutorService execService) {
        this(recordProcessorFactory, config, new AmazonKinesisClient(config.getKinesisCredentialsProvider(),
                config.getKinesisClientConfiguration()),
                new AmazonDynamoDBClient(config.getDynamoDBCredentialsProvider(),
                        config.getDynamoDBClientConfiguration()),
                new AmazonCloudWatchClient(config.getCloudWatchCredentialsProvider(),
                        config.getCloudWatchClientConfiguration()), execService);
    }
View Full Code Here

    public Worker(IRecordProcessorFactory recordProcessorFactory,
            KinesisClientLibConfiguration config, ExecutorService execService) {
        this(recordProcessorFactory, config,
            new AmazonKinesisClient(config.getKinesisCredentialsProvider(), config.getKinesisClientConfiguration()),
            new AmazonDynamoDBClient(config.getDynamoDBCredentialsProvider(), config.getDynamoDBClientConfiguration()),
            new AmazonCloudWatchClient(config.getCloudWatchCredentialsProvider(),
                    config.getCloudWatchClientConfiguration()),
            execService);
    }
View Full Code Here

     */
    public CWMetricsFactory(AWSCredentialsProvider credentialsProvider,
            String namespace,
            long bufferTimeMillis,
            int maxQueueSize) {
        this(new AmazonCloudWatchClient(credentialsProvider), namespace, bufferTimeMillis, maxQueueSize);
    }
View Full Code Here

    public CWMetricsFactory(AWSCredentialsProvider credentialsProvider,
            ClientConfiguration clientConfig,
            String namespace,
            long bufferTimeMillis,
            int maxQueueSize) {
        this(new AmazonCloudWatchClient(credentialsProvider, clientConfig), namespace, bufferTimeMillis, maxQueueSize);
    }
View Full Code Here

            ExecutorService execService) {
        this(recordProcessorFactory, config, new AmazonKinesisClient(config.getKinesisCredentialsProvider(),
                config.getKinesisClientConfiguration()),
                new AmazonDynamoDBClient(config.getDynamoDBCredentialsProvider(),
                        config.getDynamoDBClientConfiguration()),
                new AmazonCloudWatchClient(config.getCloudWatchCredentialsProvider(),
                        config.getCloudWatchClientConfiguration()), execService);
    }
View Full Code Here

     */
    public CWMetricsFactory(AWSCredentialsProvider credentialsProvider,
            String namespace,
            long bufferTimeMillis,
            int maxQueueSize) {
        this(new AmazonCloudWatchClient(credentialsProvider), namespace, bufferTimeMillis, maxQueueSize);
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.cloudwatch.AmazonCloudWatchClient

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.