Search in sources :

Example 6 with CloudWatchClient

use of software.amazon.awssdk.services.cloudwatch.CloudWatchClient in project aws-doc-sdk-examples by awsdocs.

the class PutMetricData method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "  <dataPoint> \n\n" + "Where:\n" + "  dataPoint - the value for the metric.\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    Double dataPoint = Double.parseDouble(args[0]);
    Region region = Region.US_WEST_2;
    CloudWatchClient cw = CloudWatchClient.builder().region(region).build();
    putMetData(cw, dataPoint);
    cw.close();
}
Also used : CloudWatchClient(software.amazon.awssdk.services.cloudwatch.CloudWatchClient) Region(software.amazon.awssdk.regions.Region)

Example 7 with CloudWatchClient

use of software.amazon.awssdk.services.cloudwatch.CloudWatchClient in project aws-doc-sdk-examples by awsdocs.

the class ListMetrics method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "  <namespace> \n\n" + "Where:\n" + "  namespace - the namespace to filter against (for example, AWS/EC2). \n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String namespace = args[0];
    Region region = Region.US_EAST_1;
    CloudWatchClient cw = CloudWatchClient.builder().region(region).build();
    listMets(cw, namespace);
    cw.close();
}
Also used : CloudWatchClient(software.amazon.awssdk.services.cloudwatch.CloudWatchClient) Region(software.amazon.awssdk.regions.Region)

Example 8 with CloudWatchClient

use of software.amazon.awssdk.services.cloudwatch.CloudWatchClient in project aws-doc-sdk-examples by awsdocs.

the class DisableAlarmActions method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "  DisableAlarmActions <alarmName>\n\n" + "Where:\n" + "  alarmName - an alarm name to disable (for example, MyAlarm).\n";
    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String alarmName = args[0];
    Region region = Region.US_EAST_1;
    CloudWatchClient cw = CloudWatchClient.builder().region(region).build();
    disableActions(cw, alarmName);
    cw.close();
}
Also used : CloudWatchClient(software.amazon.awssdk.services.cloudwatch.CloudWatchClient) Region(software.amazon.awssdk.regions.Region)

Example 9 with CloudWatchClient

use of software.amazon.awssdk.services.cloudwatch.CloudWatchClient in project aws-doc-sdk-examples by awsdocs.

the class PutMetricAlarm method main.

public static void main(String[] args) {
    final String USAGE = "\n" + "Usage:\n" + "  <alarmName> <instanceId> \n\n" + "Where:\n" + "  alarmName - an alarm name to use.\n" + "  instanceId - an instance Id value .\n";
    if (args.length != 2) {
        System.out.println(USAGE);
        System.exit(1);
    }
    String alarmName = args[0];
    String instanceId = args[1];
    Region region = Region.US_EAST_1;
    CloudWatchClient cw = CloudWatchClient.builder().region(region).build();
    putMetricAlarm(cw, alarmName, instanceId);
    cw.close();
}
Also used : CloudWatchClient(software.amazon.awssdk.services.cloudwatch.CloudWatchClient) Region(software.amazon.awssdk.regions.Region)

Aggregations

CloudWatchClient (software.amazon.awssdk.services.cloudwatch.CloudWatchClient)9 Region (software.amazon.awssdk.regions.Region)8 ClientConfiguration (org.apache.beam.sdk.io.aws2.common.ClientConfiguration)1 AwsOptions (org.apache.beam.sdk.io.aws2.options.AwsOptions)1 Instant (org.joda.time.Instant)1 KinesisClient (software.amazon.awssdk.services.kinesis.KinesisClient)1