Example usage for com.amazonaws.services.cloudwatch AmazonCloudWatch setEndpoint

List of usage examples for com.amazonaws.services.cloudwatch AmazonCloudWatch setEndpoint

Introduction

In this page you can find the example usage for com.amazonaws.services.cloudwatch AmazonCloudWatch setEndpoint.

Prototype

@Deprecated
void setEndpoint(String endpoint);

Source Link

Document

Overrides the default endpoint for this client ("https://monitoring.us-east-1.amazonaws.com").

Usage

From source file:com.appdynamics.extensions.cloudwatch.AmazonCloudWatchMonitor.java

License:Apache License

private void fetchAndPrintMetrics(String namespace, String region) {
    AmazonCloudWatch awsCloudWatch;
    if (credentials == null) {
        awsCloudWatch = new AmazonCloudWatchClient(clientConfiguration);
    } else {/* ww w .jav a 2 s. c o  m*/
        awsCloudWatch = new AmazonCloudWatchClient(credentials, clientConfiguration);
    }
    awsCloudWatch.setEndpoint(regionVsURLs.get(region));
    MetricsManager metricsManager = metricsManagerFactory.createMetricsManager(namespace);
    metricsManager.setWorkerPool(awsMetricWorkerPool);
    Map<String, Map<String, List<Datapoint>>> metrics = metricsManager.gatherMetrics(awsCloudWatch, region);
    // Logging number of instances for which metrics
    // were collected

    if (metricsManager instanceof CustomNamespaceMetricsManager) {
        logger.info(String.format("Custom Namespace Metrics Count - %5s:%-5s %5s:%-5s %5s:%-5d", "Region",
                region, "Namespace", namespace, "#Metric Size", metrics.size()));
    } else {
        logger.info(String.format("Running Instances Count in AWS - %5s:%-5s %5s:%-5s %5s:%-5d", "Region",
                region, "Namespace", namespace, "#Instances", metrics.size()));
    }

    metricsManager.printMetrics(region, metrics);

}

From source file:com.cfelde.aws.ddb.management.TableThroughput.java

License:Open Source License

public static void main(String... args) {
    loadPartitionState();/*w w w . ja  v a  2  s.  co  m*/

    // TODO: All these parameters should be loaded from a config file!
    String accessKey = "YOUR ACCESS KEY";
    String secretKey = "YOUR SECRET KEY";

    AmazonCloudWatch client = new AmazonCloudWatchClient(new BasicAWSCredentials(accessKey, secretKey));
    AmazonDynamoDBClient ddb = new AmazonDynamoDBClient(new BasicAWSCredentials(accessKey, secretKey));

    client.setEndpoint("https://monitoring.eu-west-1.amazonaws.com");
    ddb.setEndpoint("https://dynamodb.eu-west-1.amazonaws.com");

    // Do one per table you want to manage
    initTableThroughput(client, ddb, "table1", 2, 100, 2, 100);
    initTableThroughput(client, ddb, "table2", 2, 100, 2, 100);

    executor.scheduleWithFixedDelay(new Runnable() {
        @Override
        public void run() {
            storePartitionState();
        }
    }, 16, 61, TimeUnit.MINUTES);
}

From source file:com.netflix.servo.aws.AwsServiceClients.java

License:Apache License

/**
 * Get a CloudWatch client whose endpoint is configured based on properties.
 *///w  ww  .ja v  a 2 s . c  om
public static AmazonCloudWatch cloudWatch(AWSCredentialsProvider credentials) {
    AmazonCloudWatch client = new AmazonCloudWatchClient(credentials);
    client.setEndpoint(System.getProperty(AwsPropertyKeys.AWS_CLOUD_WATCH_END_POINT.getBundle(),
            "monitoring.amazonaws.com"));
    return client;
}

From source file:eu.optimis.monitoring.amazoncollector.MeasurementsHelper.java

License:Apache License

public AmazonCloudWatch getAmazonCloudWatchClient() {
    AmazonCloudWatch cw = new AmazonCloudWatchClient(new BasicAWSCredentials(access_key, secret_key));
    cw.setEndpoint("monitoring.eu-west-1.amazonaws.com");
    return cw;/*from  w  w  w.  jav  a  2  s.co  m*/
}

From source file:org.apache.camel.component.aws.cw.CwEndpoint.java

License:Apache License

AmazonCloudWatch createCloudWatchClient() {
    AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(),
            configuration.getSecretKey());
    AmazonCloudWatch client = new AmazonCloudWatchClient(credentials);
    if (configuration.getAmazonCwEndpoint() != null) {
        client.setEndpoint(configuration.getAmazonCwEndpoint());
    }//from ww  w  . j av a2  s  .c  o m
    return client;
}