telegraf/plugins/inputs/cloudwatch
Andy Day bae149315f Fix make test w/ go 1.7.1; Add support for enhanced wildcard dimension values
fix build
2016-10-15 16:58:39 -07:00
..
README.md Fix make test w/ go 1.7.1; Add support for enhanced wildcard dimension values 2016-10-15 16:58:39 -07:00
cloudwatch.go Fix make test w/ go 1.7.1; Add support for enhanced wildcard dimension values 2016-10-15 16:58:39 -07:00
cloudwatch_test.go Fix make test w/ go 1.7.1; Add support for enhanced wildcard dimension values 2016-10-15 16:58:39 -07:00

README.md

Amazon CloudWatch Statistics Input

This plugin will pull Metric Statistics from Amazon CloudWatch.

Amazon Authentication

This plugin uses a credential chain for Authentication with the CloudWatch API endpoint. In the following order the plugin will attempt to authenticate.

  1. Assumed credentials via STS if role_arn attribute is specified (source credentials are evaluated from subsequent rules)
  2. Explicit credentials from access_key, secret_key, and token attributes
  3. Shared profile from profile attribute
  4. Environment Variables
  5. Shared Credentials
  6. EC2 Instance Profile

Configuration:

[[inputs.cloudwatch]]
  ## Amazon Region (required)
  region = 'us-east-1'

  ## Requested CloudWatch aggregation Period (required - must be a multiple of 60s)
  period = '1m'

  ## Collection Delay (required - must account for metrics availability via CloudWatch API)
  delay = '1m'

  ## Override global run interval (optional - defaults to global interval)
  ## Recomended: use metric 'interval' that is a multiple of 'period' to avoid
  ## gaps or overlap in pulled data
  interval = '1m'

  ## Metric Statistic Namespace (required)
  namespace = 'AWS/ELB'

  ## Maximum requests per second. Note that the global default AWS rate limit is
  ## 10 reqs/sec, so if you define multiple namespaces, these should add up to a
  ## maximum of 10. Optional - default value is 10.
  ratelimit = 10

  ## Metrics to Pull (optional)
  ## Defaults to all Metrics in Namespace if nothing is provided
  ## Refreshes Namespace available metrics every 1h
  [[inputs.cloudwatch.metrics]]
    names = ['Latency', 'RequestCount']

    ## Dimension filters for Metric (optional)
    [[inputs.cloudwatch.metrics.dimensions]]
      name = 'LoadBalancerName'
      value = 'p-example'

    [[inputs.cloudwatch.metrics.dimensions]]
      name = 'AvailabilityZone'
      value = '*'

Requirements and Terminology

Plugin Configuration utilizes CloudWatch concepts and access pattern to allow monitoring of any CloudWatch Metric.

  • region must be a valid AWS Region value
  • period must be a valid CloudWatch Period value
  • namespace must be a valid CloudWatch Namespace value
  • names must be valid CloudWatch Metric names
  • dimensions must be valid CloudWatch Dimension name/value pairs

A wildcard (*) can be used in the dimension value as follows:

  • value = '*' or value = '' - includes metrics that have the specified dimension name and any value same as Regexp('.*')
  • value = 'foo*' - includes metrics that have the specified dimension name and any value that starts with foo same as Regexp('foo.*')

If dimension wildcards are used, the metric must contain all the configured dimensions where the the value matches the wildcard pattern.

Example 1:

[[inputs.cloudwatch.metrics]]
  names = ['Latency']

  ## Dimension filters for Metric (optional)
  [[inputs.cloudwatch.metrics.dimensions]]
    name = 'LoadBalancerName'
    value = 'foo-*'

  [[inputs.cloudwatch.metrics.dimensions]]
    name = 'AvailabilityZone'
    value = '*'

If the following ELBs are available:

  • LoadBalancerName: foo-example1, AvailabilityZone: us-east-1a
  • LoadBalancerName: foo-example1, AvailabilityZone: us-east-1b
  • LoadBalancerName: foo-example2, AvailabilityZone: us-east-1a
  • LoadBalancerName: foo-example2, AvailabilityZone: us-east-1b
  • LoadBalancerName: bar-example, AvailabilityZone: us-east-1a
  • LoadBalancerName: bar-example, AvailabilityZone: us-east-1b

Then 4 metrics will be output:

  • LoadBalancerName: foo-example1, AvailabilityZone: us-east-1a
  • LoadBalancerName: foo-example1, AvailabilityZone: us-east-1b
  • LoadBalancerName: foo-example2, AvailabilityZone: us-east-1a
  • LoadBalancerName: foo-example2, AvailabilityZone: us-east-1b

Example 2:

[[inputs.cloudwatch.metrics]]
  names = ['Latency']

  ## Dimension filters for Metric (optional)
  [[inputs.cloudwatch.metrics.dimensions]]
    name = 'LoadBalancerName'
    value = 'foo-example1'

If the following ELBs are available:

  • LoadBalancerName: foo-example1, AvailabilityZone: us-east-1a
  • LoadBalancerName: foo-example1, AvailabilityZone: us-east-1b
  • LoadBalancerName: foo-example2, AvailabilityZone: us-east-1a
  • LoadBalancerName: foo-example2, AvailabilityZone: us-east-1b
  • LoadBalancerName: bar-example, AvailabilityZone: us-east-1a
  • LoadBalancerName: bar-example, AvailabilityZone: us-east-1b

Then 4 metrics will be output:

  • LoadBalancerName: foo-example1 - aggregated across all availability zones.

Restrictions and Limitations

Measurements & Fields:

Each CloudWatch Namespace monitored records a measurement with fields for each available Metric Statistic Namespace and Metrics are represented in snake case

  • cloudwatch_{namespace}
    • {metric}_sum (metric Sum value)
    • {metric}_average (metric Average value)
    • {metric}_minimum (metric Minimum value)
    • {metric}_maximum (metric Maximum value)
    • {metric}_sample_count (metric SampleCount value)

Tags:

Each measurement is tagged with the following identifiers to uniquely identify the associated metric Tag Dimension names are represented in snake case

  • All measurements have the following tags:
    • region (CloudWatch Region)
    • unit (CloudWatch Metric Unit)
    • {dimension-name} (Cloudwatch Dimension value - one for each metric dimension)

Example Output:

$ ./telegraf -config telegraf.conf -input-filter cloudwatch -test
> cloudwatch_aws_elb,load_balancer_name=p-example,region=us-east-1,unit=seconds latency_average=0.004810798017284538,latency_maximum=0.1100282669067383,latency_minimum=0.0006084442138671875,latency_sample_count=4029,latency_sum=19.382705211639404 1459542420000000000