Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions roles/debian/aws_cloudwatch_agent/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ aws_cloudwatch_agent:
# Group prefix. Useful for grouping by environments.
# Eg. instead of "syslog", you can have "dev syslog", "prod syslog", etc.
log_group_prefix: ""
# Enable collectd integration
collectd:
enabled: false
# You'd normally use IAM policies, but that allows
# non-AWS servers to log in cloudwatch too.
use_credentials: false
Expand Down
5 changes: 5 additions & 0 deletions roles/debian/aws_cloudwatch_agent/templates/config.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@
],
"metrics_collection_interval": 60
}
{%- if aws_cloudwatch_agent.collectd is defined and aws_cloudwatch_agent.collectd.enabled %}
,"collectd": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid bad JSON this might need to be this:

				"metrics_collection_interval": 60
            }{%- if aws_cloudwatch_agent.collectd is defined and aws_cloudwatch_agent.collectd.enabled %},
			"collectd": {

"metrics_aggregation_interval": 60
}
{%- endif %}
}
}
}
5 changes: 5 additions & 0 deletions roles/debian/collectd/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Restart collectd
ansible.builtin.service:
name: collectd
state: restarted
7 changes: 7 additions & 0 deletions roles/debian/collectd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,10 @@
force: true
when:
- collectd_configdir.stat.exists
notify: Restart collectd

- name: Ensure collectd service is enabled and started.
ansible.builtin.service:
name: collectd
state: started
enabled: true
Loading