-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Install/configure new CloudWatch agent
Use new agent for collecting CloudWatch metrics and logs.
- Loading branch information
Showing
30 changed files
with
217 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 13 additions & 7 deletions
20
...cdo-cloudwatch-extra-metrics/.kitchen.yml → cookbooks/cdo-cloudwatch-agent/.kitchen.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
# Note: EC2 driver with IAM Instance Profile required to run integration test successfully, e.g.: | ||
# IAM_PROFILE_NAME=[IAMProfileName] KITCHEN_LOCAL_YAML=../.kitchen.ec2.yml bundle exec kitchen verify | ||
--- | ||
transport: | ||
name: sftp | ||
driver: | ||
name: docker | ||
use_sudo: false | ||
name: dokken | ||
chef_version: 15.2.20 | ||
privileged: true | ||
verifier: | ||
name: inspec | ||
transport: | ||
name: dokken | ||
provisioner: | ||
name: chef_zero | ||
require_chef_omnibus: 15.2.20 | ||
name: dokken | ||
platforms: | ||
- name: ubuntu-18.04 | ||
driver: | ||
image: dokken/ubuntu-18.04 | ||
run_list: | ||
- recipe[apt] | ||
suites: | ||
- name: default | ||
run_list: | ||
- recipe[cdo-cloudwatch-extra-metrics] | ||
- recipe[cdo-cloudwatch-agent] | ||
attributes: | ||
cdo-cloudwatch-agent: |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cdo-cloudwatch-agent Cookbook | ||
===================================== | ||
|
||
Installs/configures CloudWatch Agent, following setup instructions defined at | ||
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
default['cdo-cloudwatch-agent'] = { | ||
log_files: { | ||
amazon_cloudwatch_agent: '/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log', | ||
syslog: '/var/log/syslog' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name 'cdo-cloudwatch-agent' | ||
maintainer 'Code.org' | ||
maintainer_email 'will@code.org' | ||
license 'All rights reserved' | ||
description 'Installs/Configures cdo-cloudwatch-agent' | ||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
version '0.1.1' | ||
|
||
depends 'aws_cloudwatch' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# Cookbook Name:: cdo-cloudwatch-agent | ||
# Recipe:: default | ||
# | ||
|
||
aws_cloudwatch_agent 'default' do | ||
action [:install, :configure, :restart] | ||
json_config 'amazon-cloudwatch-agent.json.erb' | ||
end |
81 changes: 81 additions & 0 deletions
81
cookbooks/cdo-cloudwatch-agent/templates/default/amazon-cloudwatch-agent.json.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"metrics": { | ||
"append_dimensions": { | ||
"AutoScalingGroupName":"${aws:AutoScalingGroupName}", | ||
"InstanceId":"${aws:InstanceId}" | ||
}, | ||
"aggregation_dimensions": [["AutoScalingGroupName"]], | ||
"metrics_collected": { | ||
"statsd": {}, | ||
"cpu": { | ||
"totalcpu": true, | ||
"measurement": [ | ||
"cpu_usage_idle", | ||
"cpu_usage_nice", | ||
"cpu_usage_iowait", | ||
"cpu_usage_system", | ||
"cpu_usage_user" | ||
], | ||
"metrics_collection_interval": 1, | ||
"append_dimensions": { | ||
"Environment": "<%=node.chef_environment%>" | ||
} | ||
}, | ||
"disk": { | ||
"measurement": [ | ||
"free", | ||
"used_percent" | ||
], | ||
"ignore_file_system_types": [ | ||
"sysfs", "devtmpfs", "squashfs", "tmpfs" | ||
], | ||
"append_dimensions": { | ||
"Environment": "<%=node.chef_environment%>" | ||
} | ||
}, | ||
"swap": { | ||
"measurement": [ | ||
"swap_used", | ||
"swap_free" | ||
], | ||
"append_dimensions": { | ||
"Environment": "<%=node.chef_environment%>" | ||
} | ||
}, | ||
"mem": { | ||
"measurement": [ | ||
"mem_used_percent", | ||
"mem_cached", | ||
"mem_total" | ||
], | ||
"metrics_collection_interval": 1, | ||
"append_dimensions": { | ||
"Environment": "<%=node.chef_environment%>" | ||
} | ||
}, | ||
"processes": { | ||
"measurement": [ | ||
"processes_running", | ||
"processes_sleeping", | ||
"processes_total", | ||
"processes_dead", | ||
"total_threads" | ||
], | ||
"append_dimensions": { | ||
"Environment": "<%=node.chef_environment%>" | ||
} | ||
} | ||
}, | ||
"force_flush_interval" : 30 | ||
}, | ||
"logs": { | ||
"logs_collected": { | ||
"files": { | ||
"collect_list": <%= node.default['cdo-cloudwatch-agent']['log_files'].map do |name, path| | ||
{log_group_name: "#{node.chef_environment}-#{name}", file_path: path} | ||
end.to_json %> | ||
} | ||
}, | ||
"force_flush_interval" : 15 | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
cookbooks/cdo-cloudwatch-agent/test/integration/default/inspec/ruby_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'serverspec' | ||
set :backend, :exec | ||
|
||
def cmd(exec, match) | ||
describe command(exec) do | ||
its(:stdout) {should match match} | ||
end | ||
end | ||
|
||
# Ensure proper version of agent is installed. | ||
cmd '/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent --version', 'AmazonCloudWatchAgent v1.231221.0' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
cookbooks/cdo-cloudwatch-extra-metrics/test/integration/default/serverspec/ruby_spec.rb
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.