This Docker container contains Amazon EC2 scripts to simplify reporting additional EC2 instance information to Cloudwatch. These Perl scripts comprise a fully functional examples that reports memory, swap, and disk space utilization metrics for a Linux instance. You can learn more about the scripts here.
Run with host /proc/
mounted readonly to /host/proc/
Options:
-d disk_path
- reportdisk_path
disk usage, mat be used multiple times-s
- report swap usage-m
- report memory usage
docker run -v /proc/:/host/proc/:ro -v /media:/mnt/a:ro unifio/cloudwatch-monitoring -m -s -d /etc/hosts -d /mnt/a
If you have correct IAM role associated with the instance, it will work without explicit credentials specification. See Configuration section for the ways to specify credentials.
You can specify credentials in the following ways:
IAM role is automatically taken from instance's metadata. Role may be also put into AWS_IAM_ROLE
variable.
Instance's IAM role should have the following permissions:
cloudwatch:PutMetricData
cloudwatch:GetMetricStatistics
cloudwatch:ListMetrics
ec2:DescribeTags
Create credentials file with the following content:
AWSAccessKeyId=YourAccessKeyID
AWSSecretKey=YourSecretAccessKey
Add it to the container to path /awscreds
: docker run -v ./aws_creds_file.txt:/awscreds ...
Use the following env. Variable to set the crontab timeframe.
CWM_CRON_TIME
ieCWM_CRON_TIME="*/5 * * * *"
the default isCWM_CRON_TIME="* * * * *"
Use the following env. Variable to set crontab to debug. The default is to pipe stdout from scripts to /dev/null
CWM_CRON_DEBUG
ieCWM_CRON_DEBUG=1
the default isCWM_CRON_DEBUG=
Use the following env. variables for credentials:
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
AWS_IAM_ROLE
- IAM role name, used only ifAWS_ACCESS_KEY_ID
orAWS_SECRET_ACCESS_KEY
not specified/empty.