Amazon CloudWatch Output for Telegraf
Telegraf is a plugin-driven server agent for collecting and reporting metrics. Enable memory utilization reporting to Amazon CloudWatch via theCloudWatch Telegraf output plugin. To get the CloudWatch output plugin to report memory utilization, add the following to your telegraf.conf file on all your instances.
namepass = ["mem"]
fieldpass = ["used"]
region = "eu-west-1"
namespace = "InfluxData/Telegraf"
This configuration will report the memory used metric to CloudWatch in the InfluxData/Telegraf namespace. As seen in the above snippet, take care to ensure the namepass and fieldpass configuration properties are set. If those are removed, Telegraf will send all metrics to CloudWatch which can be quite costly. The above configuration only enables 1 metric reported (memory used) per instance.
You will also need to ensure that your instance has an IAM role associated that has permission to call the cloudwatch:PutMetricData API. If the instance does not have permission to call that API, the Telegraf CloudWatch output plugin will not be able to send the memory used metric to CloudWatch. For more details on the authentication the Telegraf CloudWatch output plugin uses see https://github.com/influxdata/telegraf/blob/master/plugins/outputs/cloudwatch/README.md#amazon-authentication.