Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Commit 9001171

Browse files
committed
updating cloudwatch agent role to use collectd role
1 parent b2f8bac commit 9001171

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

roles/debian/aws_cloudwatch_agent/defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ aws_cloudwatch_agent:
77
# Group prefix. Useful for grouping by environments.
88
# Eg. instead of "syslog", you can have "dev syslog", "prod syslog", etc.
99
log_group_prefix: ""
10+
# Enable collectd integration
11+
collectd:
12+
enabled: false
1013
# You'd normally use IAM policies, but that allows
1114
# non-AWS servers to log in cloudwatch too.
1215
use_credentials: false

roles/debian/aws_cloudwatch_agent/templates/config.json.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@
108108
],
109109
"metrics_collection_interval": 60
110110
}
111+
{%- if aws_cloudwatch_agent.collectd is defined and aws_cloudwatch_agent.collectd.enabled %}
112+
,"collectd": {
113+
"metrics_aggregation_interval": 60
114+
}
115+
{%- endif %}
111116
}
112117
}
113118
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
- name: Restart collectd
3+
ansible.builtin.service:
4+
name: collectd
5+
state: restarted

roles/debian/collectd/tasks/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,10 @@
3434
force: true
3535
when:
3636
- collectd_configdir.stat.exists
37+
notify: Restart collectd
38+
39+
- name: Ensure collectd service is enabled and started.
40+
ansible.builtin.service:
41+
name: collectd
42+
state: started
43+
enabled: true

0 commit comments

Comments
 (0)