Compare commits
2 Commits
ee983f21a1
...
master
Author | SHA1 | Date | |
---|---|---|---|
f9ff1caf93 | |||
44b6ceb151 |
40
tasks/config-collect.json
Normal file
40
tasks/config-collect.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"agent": {
|
||||
"metrics_collection_interval": 60,
|
||||
"run_as_user": "cwagent"
|
||||
},
|
||||
"metrics": {
|
||||
"namespace": "CWAgent",
|
||||
"append_dimensions": {
|
||||
"AutoScalingGroupName": "${aws:AutoScalingGroupName}",
|
||||
"ImageId": "${aws:ImageId}",
|
||||
"InstanceId": "${aws:InstanceId}",
|
||||
"InstanceType": "${aws:InstanceType}"
|
||||
},
|
||||
"metrics_collected": {
|
||||
"collectd": {
|
||||
"metrics_aggregation_interval": 60
|
||||
},
|
||||
"disk": {
|
||||
"measurement": [
|
||||
"used_percent"
|
||||
],
|
||||
"metrics_collection_interval": 60,
|
||||
"resources": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
"mem": {
|
||||
"measurement": [
|
||||
"mem_used_percent"
|
||||
],
|
||||
"metrics_collection_interval": 60
|
||||
},
|
||||
"statsd": {
|
||||
"metrics_aggregation_interval": 60,
|
||||
"metrics_collection_interval": 10,
|
||||
"service_address": ":8125"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
70
tasks/config.json
Normal file
70
tasks/config.json
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"agent": {
|
||||
"metrics_collection_interval": 60,
|
||||
"run_as_user": "cwagent"
|
||||
},
|
||||
"metrics": {
|
||||
"aggregation_dimensions": [
|
||||
[
|
||||
"InstanceId"
|
||||
]
|
||||
],
|
||||
"append_dimensions": {
|
||||
"AutoScalingGroupName": "${aws:AutoScalingGroupName}",
|
||||
"ImageId": "${aws:ImageId}",
|
||||
"InstanceId": "${aws:InstanceId}",
|
||||
"InstanceType": "${aws:InstanceType}"
|
||||
},
|
||||
"metrics_collected": {
|
||||
"cpu": {
|
||||
"measurement": [
|
||||
"cpu_usage_idle",
|
||||
"cpu_usage_iowait",
|
||||
"cpu_usage_user",
|
||||
"cpu_usage_system"
|
||||
],
|
||||
"metrics_collection_interval": 60,
|
||||
"resources": [
|
||||
"*"
|
||||
],
|
||||
"totalcpu": false
|
||||
},
|
||||
"disk": {
|
||||
"measurement": [
|
||||
"used_percent",
|
||||
"inodes_free"
|
||||
],
|
||||
"metrics_collection_interval": 60,
|
||||
"resources": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
"diskio": {
|
||||
"measurement": [
|
||||
"io_time"
|
||||
],
|
||||
"metrics_collection_interval": 60,
|
||||
"resources": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
"mem": {
|
||||
"measurement": [
|
||||
"mem_used_percent"
|
||||
],
|
||||
"metrics_collection_interval": 60
|
||||
},
|
||||
"statsd": {
|
||||
"metrics_aggregation_interval": 60,
|
||||
"metrics_collection_interval": 10,
|
||||
"service_address": ":8125"
|
||||
},
|
||||
"swap": {
|
||||
"measurement": [
|
||||
"swap_used_percent"
|
||||
],
|
||||
"metrics_collection_interval": 60
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
- name: Install collectd
|
||||
apt:
|
||||
name: collectd
|
||||
state: present
|
||||
#- name: Install collectd
|
||||
# apt:
|
||||
# name: collectl
|
||||
# state: present
|
||||
|
||||
- name: Install CloudWatch agent for Ubuntu
|
||||
apt:
|
||||
@ -12,47 +12,7 @@
|
||||
copy:
|
||||
dest: /opt/aws/amazon-cloudwatch-agent/bin/config.json
|
||||
backup: yes
|
||||
content: |
|
||||
{
|
||||
"agent": {
|
||||
"metrics_collection_interval": 60,
|
||||
"run_as_user": "cwagent"
|
||||
},
|
||||
"metrics": {
|
||||
"namespace": "CWAgent",
|
||||
"append_dimensions": {
|
||||
"AutoScalingGroupName": "${aws:AutoScalingGroupName}",
|
||||
"ImageId": "${aws:ImageId}",
|
||||
"InstanceId": "${aws:InstanceId}",
|
||||
"InstanceType": "${aws:InstanceType}"
|
||||
},
|
||||
"metrics_collected": {
|
||||
"collectd": {
|
||||
"metrics_aggregation_interval": 60
|
||||
},
|
||||
"disk": {
|
||||
"measurement": [
|
||||
"used_percent"
|
||||
],
|
||||
"metrics_collection_interval": 60,
|
||||
"resources": [
|
||||
"*"
|
||||
]
|
||||
},
|
||||
"mem": {
|
||||
"measurement": [
|
||||
"mem_used_percent"
|
||||
],
|
||||
"metrics_collection_interval": 60
|
||||
},
|
||||
"statsd": {
|
||||
"metrics_aggregation_interval": 60,
|
||||
"metrics_collection_interval": 10,
|
||||
"service_address": ":8125"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
src: config.json
|
||||
|
||||
- name: Enable and start agent
|
||||
shell: /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json -s
|
||||
|
Loading…
Reference in New Issue
Block a user