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

Test #3316

Closed
Closed

Conversation

rmyers808
Copy link

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.

@rmyers808 rmyers808 closed this Oct 8, 2017
@rmyers808 rmyers808 deleted the rmyers_avs_engine_stats branch October 8, 2017 11:27
@rmyers808 rmyers808 restored the rmyers_avs_engine_stats branch October 8, 2017 12:34
@rmyers808 rmyers808 reopened this Oct 8, 2017
@rmyers808 rmyers808 closed this Oct 8, 2017
@rmyers808 rmyers808 force-pushed the rmyers_avs_engine_stats branch from 15a3a30 to 0f452ad Compare October 8, 2017 12:38
@rmyers808 rmyers808 deleted the rmyers_avs_engine_stats branch October 8, 2017 12:41
@rmyers808 rmyers808 changed the title Rmyers avs engine stats Rmyers Oct 8, 2017
@rmyers808 rmyers808 changed the title Rmyers Test Oct 8, 2017
adamchainz added a commit to adamchainz/telegraf that referenced this pull request Oct 12, 2017
Fixes influxdata#3316. Use STS to validate the provided credentials work, rather than `ListMetricData` which requires a separate permission, and document the required permission.

- [x] Signed [CLA](https://influxdata.com/community/cla/).
- [x] Associated README.md updated.
- [x] Has appropriate unit tests.

I'm not sure about unit tests since none exist using mock AWS, but I did some manual testing.

I made a test IAM user with only `cloudwatch:PutMetricData` permission, policy:

```
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "cloudwatch:PutMetricData"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
```

I then used its access key as environment variables locally and ran telegraf in this environment, with this config:

```ini
[agent]
  debug = "true"

[[outputs.cloudwatch]]
  region = "eu-west-1"
  namespace = "InfluxData/Telegraf"

[[inputs.cpu]]
```

I then successfully saw data flushed when running telegraf like so:

```
$ ./telegraf --config test.conf
2017-10-12T22:23:07Z D! Attempting connection to output: cloudwatch
2017-10-12T22:23:07Z D! Successfully connected to output: cloudwatch
2017-10-12T22:23:07Z I! Starting Telegraf v1.5.0~c74c29b1
2017-10-12T22:23:07Z I! Loaded outputs: cloudwatch
2017-10-12T22:23:07Z I! Loaded inputs: inputs.cpu
2017-10-12T22:23:07Z I! Tags enabled: host=Adams-MacBook-Pro-2.local
2017-10-12T22:23:07Z I! Agent Config: Interval:10s, Quiet:false, Hostname:"Adams-MacBook-Pro-2.local", Flush Interval:10s
2017-10-12T22:23:20Z D! Output [cloudwatch] buffer fullness: 9 / 10000 metrics.
2017-10-12T22:23:21Z D! Output [cloudwatch] wrote batch of 9 metrics in 976.776485ms
^C2017-10-12T22:23:26Z I! Hang on, flushing any cached metrics before shutdown
2017-10-12T22:23:26Z D! Output [cloudwatch] buffer fullness: 0 / 10000 metrics.
```

And I also checked with bad credentials and saw the error message:

```
$ AWS_ACCESS_KEY_ID=foobar ./telegraf --config test.conf
2017-10-12T22:24:50Z E! cloudwatch: Cannot use credentials to connect to AWS : InvalidClientTokenId: The security token included in the request is invalid.
    status code: 403, request id: 2824d227-af9c-11e7-aa9b-f5e6ab3e0c4c
2017-10-12T22:24:50Z E! Failed to connect to output cloudwatch, retrying in 15s, error was 'InvalidClientTokenId: The security token included in the request is invalid.
    status code: 403, request id: 2824d227-af9c-11e7-aa9b-f5e6ab3e0c4c'
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant