Telegraf cloudwatch input plugin seems to be recording incorrect timestamps in influx

i have a series of data im collecting from cloudwatch and storing in a local influxdb instance. it appears that on collection, telegraf is storing all data collected in a given period with the same timestamp.

is this expected/normal behavior? it seems undesireable, as it skews the values in graphs quite a bit (though general trends are similar), compared to those sourced directly from cloudwatch.

This is not expected, a quick peek at the code seems to indicate it is using the values retrieved from AWS. Can you try using the aws cli to compare?

i have a python script collecting at the moment using boto3 thats behaving properly, so im fairly certain AWS is reporting the data correctly. happy to try with the CLI too, though i havent attempted to query that way before - what would you be interested in, seeing that it reports multiple timestamps for a given query?

Telegraf only collects the latest sample based on the period and delay options:

[[inputs.cloudwatch]]
  region = "us-west-1"
  period = "5m"
  delay = "5m"
  interval = "10s"
  namespace = "AWS/EC2"
  [[inputs.cloudwatch.metrics]]
    names = ["NetworkOut"]
    [[inputs.cloudwatch.metrics.dimensions]]
      name = "InstanceId"
      value = "*"

Converted to awscli, you will need to update the start-time and end-time each time you run this:

aws cloudwatch get-metric-statistics --region us-west-1 --namespace AWS/EC2 --period 300 --start-time 2018-04-26T00:55:00Z --end-time 2018-04-26T01:00:00Z --metric-name NetworkOut --statistics SampleCount --dimensions Name=InstanceId,Value=i-2e370b9c

Check what Telegraf thinks the latest samples are:

telegraf --input-filter cloudwatch --test
1 Like