aws cloudwatch metricset

edit

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
sts:GetCallerIdentity
iam:ListAccountAliases

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:instance
      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": 2956.2,
                "count": 5,
                "max": 3518,
                "min": 2752,
                "sum": 14781
            },
            "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.062221,
                "count": 1,
                "max": 0.062221,
                "min": 0.062221,
                "sum": 0.062221
            },
            "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.200240807631305,
                "count": 5,
                "max": 1.66666666666667,
                "min": 0.983606557374664,
                "sum": 6.001204038156525
            },
            "DatabaseConnections": {
                "avg": 0,
                "count": 5,
                "max": 0,
                "min": 0,
                "sum": 0
            },
            "DiskQueueDepth": {
                "avg": 0.00017333177789258993,
                "count": 5,
                "max": 0.0003999866671110963,
                "min": 0,
                "sum": 0.0008666588894629497
            },
            "FreeStorageSpace": {
                "avg": 20402474188.8,
                "count": 5,
                "max": 20402475008,
                "min": 20402470912,
                "sum": 102012370944
            },
            "FreeableMemory": {
                "avg": 441409536,
                "count": 5,
                "max": 441532416,
                "min": 441126912,
                "sum": 2207047680
            },
            "NetworkReceiveThroughput": {
                "avg": 490.10972816485855,
                "count": 5,
                "max": 558.940684321928,
                "min": 451.286580894607,
                "sum": 2450.5486408242928
            },
            "NetworkTransmitThroughput": {
                "avg": 2690.0969757200583,
                "count": 5,
                "max": 3200.246662555624,
                "min": 2263.632424505033,
                "sum": 13450.484878600291
            },
            "ReadIOPS": {
                "avg": 0.23333333333333334,
                "count": 5,
                "max": 1.1666666666666667,
                "min": 0,
                "sum": 1.1666666666666667
            },
            "ReadLatency": {
                "avg": 0,
                "count": 5,
                "max": 0,
                "min": 0,
                "sum": 0
            },
            "ReadThroughput": {
                "avg": 136.52650700798293,
                "count": 5,
                "max": 682.6325350399146,
                "min": 0,
                "sum": 682.6325350399146
            },
            "SwapUsage": {
                "avg": 1167360,
                "count": 5,
                "max": 1167360,
                "min": 1167360,
                "sum": 5836800
            },
            "WriteIOPS": {
                "avg": 0.2833380557009299,
                "count": 5,
                "max": 0.5666761112685211,
                "min": 0.1166647222546291,
                "sum": 1.4166902785046496
            },
            "WriteLatency": {
                "avg": 0.0002945713219218258,
                "count": 5,
                "max": 0.0007619047619047619,
                "min": 0,
                "sum": 0.001472856609609129
            },
            "WriteThroughput": {
                "avg": 2566.836454161029,
                "count": 5,
                "max": 4847.014116901948,
                "min": 477.88259608653624,
                "sum": 12834.182270805144
            }
        }
    },
    "cloud": {
        "account": {
            "id": "627959692251",
            "name": "elastic-test"
        },
        "provider": "aws",
        "region": "ap-southeast-1"
    },
    "event": {
        "dataset": "aws.cloudwatch",
        "duration": 115000,
        "module": "aws"
    },
    "metricset": {
        "name": "cloudwatch",
        "period": 10000
    },
    "service": {
        "type": "aws"
    }
}