The CloudWatch collectd plugin is a publishing extension for collectd, an open source statistic gathering daemon. With our extension all configured collectd metrics are automatically published to CloudWatch. This plugin allows monitoring of servers and applications within and outside of EC2 instances. The plugin offers additional functionality for EC2 customers such as automatic discovery of Instance ID and AWS region.
Download installation script, place it on the instance and execute it:
chmod u+x setup.py
sudo ./setup.py
Follow on screen instructions
The default location of the configuration file used by collectd-cloudwatch plugin is: /opt/collectd-plugins/cloudwatch/config/plugin.conf
. The parameters in this file are optional when plugin is executed on EC2 instance. This file allows modification of the following parameters:
.*
or .+
only is automatically disabled in the whitelist configuration.
Setting this value to True may result in a large number of metrics being published. Before changing this parameter, read pricing information to understand how to estimate your bill.Adding additional dimensions to metrics
below for details)constant_dimension_value
below) on all metrics. Useful for collating all metrics of a certain type (see Adding additional dimensions to metrics
below for details)Adding additional dimensions to metrics
below for details)credentials_path = "/home/user/.aws/credentials"
region = "us-west-1"
host = "Server1"
proxy_server_name = "http://myproxyserver.com"
proxy_server_port = "8080"
whitelist_pass_through = False
push_asg = False
push_constant = True
constant_dimension_value = "ALL"
debug = False
enable_high_resolution_metrics = False
flush_interval_in_seconds = 60
We support adding both the ASG name to dimensions, as well as a "fixed dimension". Fixed dimensions are an additional value that will be added all metrics.
push_constant = True
constant_dimension_value = "MyConstantValueHere"
The above configuration will result in all metrics being pushed with "FixedDimension" : "MyConstantValueHere"
push_constant = True
constant_dimension_value = "MyConstantValueHere"
The above configuration will result in all metrics being pushed with "FixedDimension" : "MyConstantValueHere"
push_asg = False
The above configuration will push the AutoScaling Group name for metrics as well
The account configuration is optional for EC2 instances with IAM Role attached. By default the AWS account configuration file is expected to be stored in: /opt/collectd-plugins/cloudwatch/config/.aws/credentials
.
The following parameters can be configured in the above file:
aws_access_key = valid_access_key
aws_secret_key = valid_secret_key
The CloudWatch collectd plugin allows users to select metrics to be published. This is done by adding metric names or regular expressions written in python regex syntax to the whitelist config file. The default location of this configuration is: /opt/collectd-plugins/cloudwatch/config/whitelist.conf
.
.*
swap--swap-free
memory--memory-.*
df-.*-percent_bytes-used
Once the plugin is configured correctly, restart collectd to load new configuration.
sudo /etc/init.d/collectd restart
From now on your collectd metrics will be published to CloudWatch.
Our plugin uses collectd logfile plugin. In order to enable logging in collectd, modify the collectd.conf to contain the following section:
LoadPlugin logfile
<Plugin logfile>
LogLevel info
File "/var/log/collectd.log"
Timestamp true
PrintSeverity false
</Plugin>
The collectd log can be filtered for CloudWatch plugin events using grep:
grep "[AmazonCloudWatchPlugin]" /var/log/collectd.log
git clone https://github.com/USER/cloudwatch-collectd-plugin.git
git checkout -b my-new-feature
git commit -am 'My new feature description'
git push origin my-new-feature
The MIT License (MIT)
Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.