Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telegraf unable to write metrics to CloudWatch with IMDSv1 disabled #7371

Closed
anilkun opened this issue Apr 19, 2020 · 0 comments · Fixed by #7373
Closed

Telegraf unable to write metrics to CloudWatch with IMDSv1 disabled #7371

anilkun opened this issue Apr 19, 2020 · 0 comments · Fixed by #7373
Labels
area/aws AWS plugins including cloudwatch, ecs, kinesis bug unexpected problem or unintended behavior
Milestone

Comments

@anilkun
Copy link
Contributor

anilkun commented Apr 19, 2020

Hi Team,

I have an EC2 instance where AWS IMDSV1 is disabled and AWS IMDSV2 is enabled for security reasons. The instance is attached with IAM role with enough privileges. When I deploy telegraf with cloudwatch output plugin, telegraf is unable to write metrics to CloudWatch because it cannot find aws credentials or config file. I tried with providing role_arn and profile but the issue persists.

Relevant telegraf.conf:

[[outputs.cloudwatch]]
region = "us-west-2"
namespace = "test"
role_arn = ""

System info:

Ubuntu 18.04

Steps to reproduce:

  1. Disable AWS IMDSV1 on an EC2 instance
  2. Configure telegraf cloudwatch output plugin
  3. Attach IAM role to EC2 instance
  4. Start telegraf

Actual behavior:

systemctl status telegraf
● telegraf.service - The plugin-driven server agent for reporting metrics into InfluxDB
   Loaded: loaded (/lib/systemd/system/telegraf.service; disabled; vendor preset: enabled)
   Active: active (running) since Sun 2020-04-19 03:52:07 UTC; 1min 54s ago
     Docs: https://github.com/influxdata/telegraf
 Main PID: 12607 (telegraf)
    Tasks: 11 (limit: 4451)
   CGroup: /system.slice/telegraf.service
           └─12607 /usr/bin/telegraf -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraf/telegraf.d

Apr 19 03:52:07 ip-xxx-xx-x-xxx telegraf[12607]: 2020-04-19T03:52:07Z D! [agent] Initializing plugins
Apr 19 03:52:07 ip-xxx-xx-x-xxx telegraf[12607]: 2020-04-19T03:52:07Z D! [agent] Connecting outputs
Apr 19 03:52:07 ip-xxx-xx-x-xxx telegraf[12607]: 2020-04-19T03:52:07Z D! [agent] Attempting connection to [outputs.cloudwatch]
Apr 19 03:52:07 ip-xxx-xx-x-xxx telegraf[12607]: 2020-04-19T03:52:07Z D! [agent] Successfully connected to outputs.cloudwatch
Apr 19 03:52:07 ip-xxx-xx-x-xxx telegraf[12607]: 2020-04-19T03:52:07Z D! [agent] Starting service inputs
Apr 19 03:54:00 ip-xxx-xx-x-xxx telegraf[12607]: 2020-04-19T03:54:00Z E! CloudWatch: Unable to write to CloudWatch : NoCredentialProviders: no valid providers in chain. Deprecated.
Apr 19 03:54:00 ip-xxx-xx-x-xxx telegraf[12607]:         For verbose messaging see aws.Config.CredentialsChainVerboseErrors
Apr 19 03:54:00 ip-xxx-xx-x-xxx telegraf[12607]: 2020-04-19T03:54:00Z D! [outputs.cloudwatch] Buffer fullness: 6 / 10000 metrics
Apr 19 03:54:00 ip-xxx-xx-x-xxx telegraf[12607]: 2020-04-19T03:54:00Z E! [agent] Error writing to outputs.cloudwatch: NoCredentialProviders: no valid providers in chain. Deprecated.
Apr 19 03:54:00 ip-xxx-xx-x-xxx telegraf[12607]:         For verbose messaging see aws.Config.CredentialsChainVerboseErrors
anilkun pushed a commit to anilkun/telegraf that referenced this issue Apr 19, 2020
…disabled

AWS GO SDK released support for AWS Metadata service v2 as SDK
enhancement from [Release](https://github.com/aws/aws-sdk-go/blob/master/CHANGELOG.md#release-v12538-2019-11-19)
The current AWS SDK version used in cloud watch output plugin
has to updated to version >= 1.25.38 to have support for IMDSV2
@danielnelson danielnelson added area/aws AWS plugins including cloudwatch, ecs, kinesis bug unexpected problem or unintended behavior labels Apr 20, 2020
@danielnelson danielnelson added this to the 1.15.0 milestone Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/aws AWS plugins including cloudwatch, ecs, kinesis bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants