Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
bf9f94eb
Commit
bf9f94eb
authored
7 years ago
by
Adam Johnson
Committed by
Daniel Nelson
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix cloudwatch output requires unneeded permissions (#3335)
parent
0f9f757d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/outputs/cloudwatch/README.md
+2
-0
2 additions, 0 deletions
plugins/outputs/cloudwatch/README.md
plugins/outputs/cloudwatch/cloudwatch.go
+8
-8
8 additions, 8 deletions
plugins/outputs/cloudwatch/cloudwatch.go
with
10 additions
and
8 deletions
plugins/outputs/cloudwatch/README.md
+
2
−
0
View file @
bf9f94eb
...
...
@@ -13,6 +13,8 @@ API endpoint. In the following order the plugin will attempt to authenticate.
5.
[
Shared Credentials
](
https://github.com/aws/aws-sdk-go/wiki/configuring-sdk#shared-credentials-file
)
6.
[
EC2 Instance Profile
](
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
)
The IAM user needs only the
`cloudwatch:PutMetricData`
permission.
## Config
For this output plugin to function correctly the following variables
...
...
This diff is collapsed.
Click to expand it.
plugins/outputs/cloudwatch/cloudwatch.go
+
8
−
8
View file @
bf9f94eb
...
...
@@ -9,6 +9,7 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/cloudwatch"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/influxdata/telegraf"
internalaws
"github.com/influxdata/telegraf/internal/config/aws"
...
...
@@ -71,21 +72,20 @@ func (c *CloudWatch) Connect() error {
}
configProvider
:=
credentialConfig
.
Credentials
()
s
vc
:=
cloudwatch
.
New
(
configProvider
)
s
tsService
:=
sts
.
New
(
configProvider
)
params
:=
&
cloudwatch
.
ListMetricsInput
{
Namespace
:
aws
.
String
(
c
.
Namespace
),
}
params
:=
&
sts
.
GetSessionTokenInput
{}
_
,
err
:=
s
vc
.
ListMetrics
(
params
)
// Try a read-only call to test connection.
_
,
err
:=
s
tsService
.
GetSessionToken
(
params
)
if
err
!=
nil
{
log
.
Printf
(
"E! cloudwatch: Error in ListMetrics API call : %+v
\n
"
,
err
.
Error
())
log
.
Printf
(
"E! cloudwatch: Cannot use credentials to connect to AWS : %+v
\n
"
,
err
.
Error
())
return
err
}
c
.
svc
=
svc
c
.
svc
=
cloudwatch
.
New
(
configProvider
)
return
err
return
nil
}
func
(
c
*
CloudWatch
)
Close
()
error
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment