cloudwatch

package
v1.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 11 Imported by: 186

README

Amazon CloudWatch Output for Telegraf

This plugin will send metrics to Amazon CloudWatch.

Amazon Authentication

This plugin uses a credential chain for Authentication with the CloudWatch API endpoint. In the following order the plugin will attempt to authenticate.

  1. Web identity provider credentials via STS if role_arn and web_identity_token_file are specified
  2. Assumed credentials via STS if role_arn attribute is specified (source credentials are evaluated from subsequent rules)
  3. Explicit credentials from access_key, secret_key, and token attributes
  4. Shared profile from profile attribute
  5. Environment Variables
  6. Shared Credentials
  7. EC2 Instance Profile

If you are using credentials from a web identity provider, you can specify the session name using role_session_name. If left empty, the current timestamp will be used.

The IAM user needs only the cloudwatch:PutMetricData permission.

Config

For this output plugin to function correctly the following variables must be configured.

  • region
  • namespace
region

The region is the Amazon region that you wish to connect to. Examples include but are not limited to:

  • us-west-1
  • us-west-2
  • us-east-1
  • ap-southeast-1
  • ap-southeast-2
namespace

The namespace used for AWS CloudWatch metrics.

write_statistics

If you have a large amount of metrics, you should consider to send statistic values instead of raw metrics which could not only improve performance but also save AWS API cost. If enable this flag, this plugin would parse the required CloudWatch statistic fields (count, min, max, and sum) and send them to CloudWatch. You could use basicstats aggregator to calculate those fields. If not all statistic fields are available, all fields would still be sent as raw metrics.

high_resolution_metrics

Enable high resolution metrics (1 second precision) instead of standard ones (60 seconds precision)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDimensions

func BuildDimensions(mTags map[string]string) []types.Dimension

BuildDimensions makes a list of Dimensions by using a Point's tags. CloudWatch supports up to 10 dimensions per metric, so we only keep up to the first 10 alphabetically. This always includes the "host" tag if it exists.

func BuildMetricDatum

func BuildMetricDatum(buildStatistic bool, highResolutionMetrics bool, point telegraf.Metric) []types.MetricDatum

BuildMetricDatum makes a MetricDatum from telegraf.Metric. It would check if all required fields of cloudwatch.StatisticSet are available. If so, it would build MetricDatum from statistic values. Otherwise, fields would still been built independently.

func PartitionDatums

func PartitionDatums(size int, datums []types.MetricDatum) [][]types.MetricDatum

PartitionDatums partitions the MetricDatums into smaller slices of a max size so that are under the limit for the AWS API calls.

Types

type CloudWatch

type CloudWatch struct {
	Namespace             string `toml:"namespace"` // CloudWatch Metrics Namespace
	HighResolutionMetrics bool   `toml:"high_resolution_metrics"`

	WriteStatistics bool `toml:"write_statistics"`

	Log telegraf.Logger `toml:"-"`

	internalaws.CredentialConfig
	// contains filtered or unexported fields
}

func (*CloudWatch) Close

func (c *CloudWatch) Close() error

func (*CloudWatch) Connect

func (c *CloudWatch) Connect() error

func (*CloudWatch) Description

func (c *CloudWatch) Description() string

func (*CloudWatch) SampleConfig

func (c *CloudWatch) SampleConfig() string

func (*CloudWatch) Write

func (c *CloudWatch) Write(metrics []telegraf.Metric) error

func (*CloudWatch) WriteToCloudWatch

func (c *CloudWatch) WriteToCloudWatch(datums []types.MetricDatum) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL