Skip to content

Commit

Permalink
Merge pull request #9 from christiangda/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
christiangda committed Dec 29, 2019
2 parents 92d1535 + 5afec8b commit fe565b6
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 13 deletions.
19 changes: 12 additions & 7 deletions README.md
Expand Up @@ -5,20 +5,25 @@

This role [Install AWS CloudWatch Agent](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-on-first-instance.html)

**NOTES:**

* The version 2.x.y is not compatible with version 1.x.y
* This role no longer installs [EPEL Repository](https://fedoraproject.org/wiki/EPEL) by default, now you need to take care of this, I recommend my role [christiangda.epel_repo](https://galaxy.ansible.com/christiangda/epel_repo) instead
* This role no longer creates [AWS CLI profile (config and credentials)](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), now you need to take care of this, I recommend my roles [christiangda.awscli](https://galaxy.ansible.com/christiangda/awscli) and [christiangda.awscli_configure](https://galaxy.ansible.com/christiangda/awscli_configure) instead. See examples under (when cwa_agent_mode: "onPremise")

**Features:**

* Works on "AWS EC2 instances"/"On-Premise Instances"
* Support different versions of Python, Ansible and Operating Systems (see the [Continuos integration matrix for details](https://travis-ci.org/christiangda/ansible-role-amazon-cloudwatch-agent))
* Downloads and installs CloudWatch Agent from [AWS distribution package](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/verify-CloudWatch-Agent-Package-Signature.html)
* Reload service when configuration is changed
* Provide a default agent configuration file (a minimal configuration, does not recommended)
* Rotate CloudWatch Agent Log file
* **Allow you to load you own [JSON file](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-Configuration-File-Details.html) or YAML file or INLINE configuration for agent, metrics and logs sections**

**NOTES:**

* The version 2.x.y is not compatible with version 1.x.y
* Since version 2.x.y this role no longer installs [EPEL Repository](https://fedoraproject.org/wiki/EPEL) by default, now you need to take care of this, I recommend my role [christiangda.epel_repo](https://galaxy.ansible.com/christiangda/epel_repo) instead
* Since version 2.x.y this role no longer creates [AWS CLI profile (config and credentials)](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), now you need to take care of this, I recommend my roles [christiangda.awscli](https://galaxy.ansible.com/christiangda/awscli) and [christiangda.awscli_configure](https://galaxy.ansible.com/christiangda/awscli_configure) instead. See examples under (when cwa_agent_mode: "onPremise")
* Install automatically the "collectd" package when detect the use of [Retrieve Custom Metrics with collectd](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-custom-metrics-collectd.html) in the configuration file

More details in [VERSION.md](VERSION.md) file

## Requirements

This role work on RedHat, CentOS, Amazon Linux, Debian and Ubuntu distributions
Expand Down Expand Up @@ -73,6 +78,7 @@ Is important to have a valid subscription in order to avoid dependencies package

* In case of OS Family RedHat/Centos EPEL repository could be necessary
* If you set `cwa_agent_mode: "onPremise"` the [AWS CLI Profile](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html) configuration is needed
* If you [Retrieve Custom Metrics with collectd](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-custom-metrics-collectd.html) the package `collectd` will installed automatically

## Example Playbook

Expand Down Expand Up @@ -232,7 +238,6 @@ Using INLINE YAML configuration file
debug: false
metrics:
metrics_collected:
collectd: {}
cpu:
resources:
- "*"
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.0.0
2.0.1
14 changes: 12 additions & 2 deletions VERSION.md
@@ -1,3 +1,13 @@
# VERSION
# VERSION Details

WIP
## 2.0.1

* Remove the need to install collectd package when you are not [Retrieve Custom Metrics with collectd](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Agent-custom-metrics-collectd.html), reported in issue #7 --> [collectd is not a required dependency](https://github.com/christiangda/ansible-role-amazon-cloudwatch-agent/issues/7)

## 2.0.0

* The version 2.x.y is not compatible with version 1.x.y
* Since version 2.x.y this role no longer installs [EPEL Repository](https://fedoraproject.org/wiki/EPEL) by default, now you need to take care of this, I recommend my role [christiangda.epel_repo](https://galaxy.ansible.com/christiangda/epel_repo) instead
* Since version 2.x.y this role no longer creates [AWS CLI profile (config and credentials)](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html), now you need to take care of this, I recommend my roles [christiangda.awscli](https://galaxy.ansible.com/christiangda/awscli) and [christiangda.awscli_configure](https://galaxy.ansible.com/christiangda/awscli_configure) instead. See examples under (when cwa_agent_mode: "onPremise")
* Refactored to remove the oldest version of many Operating System on molecule test
* Refactored to remove the oldest version of Ansible on Ansible galaxy meta manifest, now support ansible >= 2.7
64 changes: 64 additions & 0 deletions molecule/vagrant/playbook.yml
Expand Up @@ -47,3 +47,67 @@
vars:
cwa_agent_mode: "onPremise"
cwa_profile: "AmazonCloudWatchAgent"
# - role: christiangda.amazon_cloudwatch_agent
# vars:
# cwa_agent_mode: onPremise
# cwa_aws_region: "eu-west-1"
# cwa_profile: "AmazonCloudWatchAgent"
# cwa_conf_json_file_content:
# agent:
# metrics_collection_interval: 60
# region: es-west-1
# logfile: "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
# debug: false
# metrics:
# metrics_collected:
# collectd: {}
# cpu:
# resources:
# - "*"
# measurement:
# - name: cpu_usage_idle
# rename: CPU_USAGE_IDLE
# unit: Percent
# - name: cpu_usage_nice
# unit: Percent
# - cpu_usage_guest
# totalcpu: false
# metrics_collection_interval: 10
# append_dimensions:
# test: test1
# date: "2017-10-01"
# netstat:
# measurement:
# - tcp_established
# - tcp_syn_sent
# - tcp_close
# metrics_collection_interval: 60
# processes:
# measurement:
# - running
# - sleeping
# - dead
# append_dimensions:
# ImageId: "${!aws:ImageId}"
# InstanceId: "${!aws:InstanceId}"
# InstanceType: "${!aws:InstanceType}"
# AutoScalingGroupName: "${!aws:AutoScalingGroupName}"
# aggregation_dimensions:
# - - AutoScalingGroupName
# - - InstanceId
# - InstanceType
# - []
# logs:
# logs_collected:
# files:
# collect_list:
# - file_path: "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log"
# log_group_name: amazon-cloudwatch-agent.log
# log_stream_name: amazon-cloudwatch-agent.log
# timezone: UTC
# - file_path: "/opt/aws/amazon-cloudwatch-agent/logs/test.log"
# log_group_name: test.log
# log_stream_name: test.log
# timezone: Local
# log_stream_name: my_log_stream_name
# force_flush_interval: 15
1 change: 1 addition & 0 deletions tasks/install-redhat.yml
Expand Up @@ -75,6 +75,7 @@
)
tags:
- install
when: cwa_conf_json_file_content is search("collectd")

- name: Install {{ cwa_package }}.rpm on Amazon 1/2
yum:
Expand Down
3 changes: 0 additions & 3 deletions templates/agent/amazon-cloudwatch-agent.json.j2
Expand Up @@ -26,9 +26,6 @@
"InstanceType": "${aws:InstanceType}"
},
"metrics_collected": {
"collectd": {
"metrics_aggregation_interval": 60
},
"cpu": {
"measurement": [
"cpu_usage_idle",
Expand Down

0 comments on commit fe565b6

Please sign in to comment.