aws cloudwatch metricset

edit

This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.

The cloudwatch metricset of aws module allows you to monitor various services on AWS. cloudwatch metricset fetches metrics from given namespace periodically by calling GetMetricData api.

AWS Permissions

edit

Some specific AWS permissions are required for IAM user to collect AWS Cloudwatch metrics.

ec2:DescribeRegions
cloudwatch:GetMetricData
cloudwatch:ListMetrics
tag:getResources

Metricset-specific configuration notes

edit
  • namespace: The namespace to filter against. For example, AWS/EC2, AWS/S3.
  • name: The name of the metric to filter against. For example, CPUUtilization for EC2 instance.
  • dimensions: The dimensions to filter against. For example, InstanceId=i-123.
  • tags.resource_type_filter: The constraints on the resources that you want returned. The format of each resource type is service[:resourceType]. For example, specifying a resource type of ec2 returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type of ec2:instance returns only EC2 instances.
  • statistic: Statistics are metric data aggregations over specified periods of time. By default, statistic includes Average, Sum, Count, Maximum and Minimum.

Configuration example

edit

To be more focused on cloudwatch metricset use cases, the examples below do not include configurations on AWS credentials. Please see AWS credentials options for more details on setting AWS credentials in configurations in order for this metricset to make proper AWS API calls.

- module: aws
  period: 300s
  metricsets:
    - cloudwatch
  metrics:
    - namespace: AWS/EBS 
    - namespace: AWS/ELB 
      tags.resource_type_filter: elasticloadbalancing
    - namespace: AWS/EC2 
      name: CPUUtilization
      statistic: ["Average"]
      dimensions:
        - name: InstanceId
          value: i-0686946e22cf9494a

Users can configure the cloudwatch metricset to collect all metrics from one specific namespace, such as AWS/EBS.

cloudwatch metricset also has the ability to collect tags from AWS resources. If user specify tags.resource_type_filter, then tags will be collected and stored as a part of the event. Please see AWS API GetResources for more details about tags.resource_type_filter.

If users knows exactly what are the cloudwatch metrics they want to collect, this configuration format can be used. namespace and metricname need to be specified and dimensions can be used to filter cloudwatch metrics. Please see AWS List Metrics for more details.

More examples

edit

With the configuration below, users will be able to collect cloudwatch metrics from EBS, ELB and EC2 without tag information.

- module: aws
  period: 300s
  metricsets:
    - cloudwatch
  metrics:
    - namespace: AWS/EBS
    - namespace: AWS/ELB
    - namespace: AWS/EC2

With the configuration below, users will be able to collect cloudwatch metrics from EBS, ELB and EC2 with tags from these services.

- module: aws
  period: 300s
  metricsets:
    - cloudwatch
  metrics:
    - namespace: AWS/EBS
      tags.resource_type_filter: ebs
    - namespace: AWS/ELB
      tags.resource_type_filter: elasticloadbalancing
    - namespace: AWS/EC2
      tags.resource_type_filter: ec2:instance

With the configuration below, users will be able to collect specific cloudwatch metrics. For example CPUUtilization metric(average) from EC2 instance i-123 and NetworkIn metric(average) from EC2 instance i-456.

- module: aws
  period: 300s
  metricsets:
    - cloudwatch
  metrics:
    - namespace: AWS/EC2
      name: ["CPUUtilization"]
      tags.resource_type_filter: ec2:intance
      dimensions:
        - name: InstanceId
          value: i-123
      statistic: ["Average"]
    - namespace: AWS/EC2
      name: ["NetworkIn"]
      dimensions:
        - name: InstanceId
          value: i-456
      statistic: ["Average"]

This is a default metricset. If the host module is unconfigured, this metricset is enabled by default.

Fields

edit

For a description of each field in the metricset, see the exported fields section.

Here is an example document generated by this metricset:

{
    "@timestamp": "2017-10-12T08:05:34.853Z",
    "aws": {
        "cloudwatch": {
            "dimensions": {
                "DatabaseClass": "db.t2.micro"
            },
            "namespace": "AWS/RDS"
        },
        "metrics": {
            "BinLogDiskUsage": {
                "avg": 3109.2,
                "count": 5,
                "max": 3518,
                "min": 3007,
                "sum": 15546
            },
            "BurstBalance": {
                "avg": 100,
                "count": 1,
                "max": 100,
                "min": 100,
                "sum": 100
            },
            "CPUCreditBalance": {
                "avg": 144,
                "count": 1,
                "max": 144,
                "min": 144,
                "sum": 144
            },
            "CPUCreditUsage": {
                "avg": 0.059921,
                "max": 0.059921,
                "min": 0.059921,
                "sum": 0.059921
            },
            "CPUSurplusCreditBalance": {
                "avg": 0,
                "count": 1,
                "max": 0,
                "min": 0,
                "sum": 0
            },
            "CPUSurplusCreditsCharged": {
                "avg": 0,
                "count": 1,
                "max": 0,
                "min": 0,
                "sum": 0
            },
            "CPUUtilization": {
                "avg": 1.229508196720359,
                "count": 5,
                "max": 1.66666666666667,
                "min": 0.999999999997575,
                "sum": 6.147540983601795
            },
            "DatabaseConnections": {
                "avg": 0,
                "count": 5,
                "max": 0,
                "min": 0,
                "sum": 0
            },
            "DiskQueueDepth": {
                "avg": 0.0002666653337629704,
                "count": 5,
                "max": 0.0007999733342221926,
                "min": 0,
                "sum": 0.001333326668814852
            },
            "FreeStorageSpace": {
                "avg": 20402474188.8,
                "count": 5,
                "max": 20402475008,
                "min": 20402470912,
                "sum": 102012370944
            },
            "FreeableMemory": {
                "avg": 460385484.8,
                "count": 5,
                "max": 460492800,
                "min": 460238848,
                "sum": 2301927424
            },
            "NetworkReceiveThroughput": {
                "avg": 488.6774390824785,
                "count": 5,
                "max": 614.8064198930018,
                "min": 440.9387136023468,
                "sum": 2443.3871954123924
            },
            "NetworkTransmitThroughput": {
                "avg": 2629.716953080241,
                "count": 5,
                "max": 2771.060439377271,
                "min": 2426.08797106522,
                "sum": 13148.584765401207
            },
            "ReadIOPS": {
                "avg": 0.23334111137037902,
                "count": 5,
                "max": 1.1667055568518951,
                "min": 0,
                "sum": 1.1667055568518951
            },
            "ReadLatency": {
                "avg": 0,
                "count": 5,
                "max": 0,
                "min": 0,
                "sum": 0
            },
            "ReadThroughput": {
                "avg": 136.52878237392088,
                "count": 5,
                "max": 682.6439118696044,
                "min": 0,
                "sum": 682.6439118696044
            },
            "SwapUsage": {
                "avg": 638976,
                "count": 5,
                "max": 638976,
                "min": 638976,
                "sum": 3194880
            },
            "WriteIOPS": {
                "avg": 0.3600156685816308,
                "count": 5,
                "max": 0.8833627787592919,
                "min": 0,
                "sum": 1.800078342908154
            },
            "WriteLatency": {
                "avg": 0.0005464870341466086,
                "count": 5,
                "max": 0.0015238095238095239,
                "min": 0,
                "sum": 0.0027324351707330432
            },
            "WriteThroughput": {
                "avg": 3863.9343018441605,
                "count": 5,
                "max": 8055.198160061332,
                "min": 0,
                "sum": 19319.671509220803
            }
        }
    },
    "cloud": {
        "provider": "aws",
        "region": "ap-southeast-1"
    },
    "event": {
        "dataset": "aws.cloudwatch",
        "duration": 115000,
        "module": "aws"
    },
    "metricset": {
        "name": "cloudwatch",
        "period": 10000
    },
    "service": {
        "type": "aws"
    }
}