Unable to limit the scope of inputs.cloudwatch for ElasticSearch

elasticsearch
telegraf

#1

I’ve been trying different versions of the following and can’t get it to work. The only way I’ve been able to get the CloudWatch input for ElasticSearch to work is to leave the inputs.cloudwatch.metrics inputs.cloudwatch.metrics.dimensions entirely out of the config.

[[inputs.cloudwatch]]
region = "us-east-1"
access_key = “xxx”
secret_key = “xxx”
period = "5m"
delay = "5m"
interval = "5m"
namespace = "AWS/ES"
ratelimit = 200
[[inputs.cloudwatch.metrics]]
names = [“CPUUtilization”]
[[inputs.cloudwatch.metrics.dimensions]]
name = "DomainName"
value = “es-01”


#2

Does it help if you use period = "1m"? If that doesn’t help try with the dimensions value set to "*" and run telegraf --input-filter cloudwatch --test and if still no output can you run that command without the metrics section at all. Let me know what the output is.


#3

No dice. I tried:
[[inputs.cloudwatch]]
region = "us-east-1"
access_key = "xxx"
secret_key = "xxx"
period = "1m"
delay = "5m"
interval = "5m"
namespace = "AWS/ES"
ratelimit = 10
[[inputs.cloudwatch.metrics]]
names = [“CPUUtilization”]
[[inputs.cloudwatch.metrics.dimensions]]
name = "DomainName"
value = “es-01”

telegraf --config /etc/telegraf/telegraf.conf --config cloudwatch.conf --input-filter cloudwatch --test

  • Plugin: inputs.cloudwatch, Collection 1
  • Internal: 5m0s

then:

[[inputs.cloudwatch]]
region = "us-east-1"
access_key = "xxx"
secret_key = "xxx"
period = "1m"
delay = "5m"
interval = "5m"
namespace = "AWS/ES"
ratelimit = 10
[[inputs.cloudwatch.metrics]]
names = [“CPUUtilization”]
[[inputs.cloudwatch.metrics.dimensions]]
name = "DomainName"
value = “*”

And received the same result.


#4

I think the real cause of this is that there is a dimension that is unspecified. I had assumed you could leave out dimensions in the query but this does not appear to be the case, they must be fully defined as explained in the CloudWatch documentation. To resolve this I believe you must include the ClientId dimension in addition to the DomainName.

This also explains why leaving out the section completely works, when you do this the ListMetrics endpoint is called which returns a list of all dimensions, you can get this information with the aws cli like so, which may be helpful when writing your config:

aws cloudwatch list-metrics --namespace AWS/ES --region us-east-1

You should be able to set the period back to 5m or any multiple of 1 minute.

Let me know if this helps.


#5

Thanks. The following is what ended up working for me. It’s definitely not DRY, but it works.

[[inputs.cloudwatch]]
region = “us-east-1”
access_key = “xxx”
secret_key = “xxx”
period = “5m”
delay = “5m”
interval = “5m”
namespace = “AWS/ES”
ratelimit = 10
[[inputs.cloudwatch.metrics]]
names = [“CPUUtilization”]
[[inputs.cloudwatch.metrics.dimensions]]
name = “ClientId”
value = “xxx”
[[inputs.cloudwatch.metrics.dimensions]]
name = “DomainName”
value = “es-01"
[[inputs.cloudwatch.metrics]]
names = [“CPUUtilization”]
[[inputs.cloudwatch.metrics.dimensions]]
[[inputs.cloudwatch.metrics.dimensions]]
name = “ClientId”
value = “xxx”
[[inputs.cloudwatch.metrics.dimensions]]
name = “DomainName”
value = “es-02”


#6

Hi , I had the same issue, got resolved using the proper dimensions for the name space, but i am not able to specify the statistics which i want to capture for each metric, as currently it is capturing all sum, maximum, minimum etc