Skip to content

Instantly share code, notes, and snippets.

@davecap
Created April 24, 2014 02:20
Show Gist options
  • Save davecap/11239288 to your computer and use it in GitHub Desktop.
Save davecap/11239288 to your computer and use it in GitHub Desktop.
.ebextensions/99datadog.config
# .ebextensions/99datadog.config
container_commands:
01chmod:
command: "chmod +x .ebextensions/datadog/hooks/*"
02mkdir_appdeploy_post:
test: '[ ! -d /opt/elasticbeanstalk/hooks/appdeploy/post ]'
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
02mkdir_configdeploy_post:
test: '[ ! -d /opt/elasticbeanstalk/hooks/configdeploy/post ]'
command: "mkdir /opt/elasticbeanstalk/hooks/configdeploy/post"
10appdeploy_pre_stop:
command: "cp .ebextensions/datadog/hooks/99stop_datadog.sh /opt/elasticbeanstalk/hooks/appdeploy/pre/"
11appdeploy_post_start:
command: "cp .ebextensions/datadog/hooks/99start_datadog.sh /opt/elasticbeanstalk/hooks/appdeploy/post/"
20preinit_stop:
command: "cp .ebextensions/datadog/hooks/99stop_datadog.sh /opt/elasticbeanstalk/hooks/preinit"
21postinit_start:
command: "cp .ebextensions/datadog/hooks/99start_datadog.sh /opt/elasticbeanstalk/hooks/postinit"
30configdeploy_pre_stop:
command: "cp .ebextensions/datadog/hooks/99stop_datadog.sh /opt/elasticbeanstalk/hooks/configdeploy/pre/"
31configdeploy_post_start:
command: "cp .ebextensions/datadog/hooks/99start_datadog.sh /opt/elasticbeanstalk/hooks/configdeploy/post/"
90install_datadog:
command: "cp .ebextensions/datadog/datadog.repo /etc/yum.repos.d/datadog.repo; yum -y makecache; yum -y install datadog-agent; /etc/init.d/datadog-agent stop"
91setup_datadog:
test: '[ ! -e /etc/dd-agent/datadog.conf ]'
command: "sh -c \"sed 's/api_key:.*/api_key: YOUR_API_KEY/' /etc/dd-agent/datadog.conf.example > /etc/dd-agent/datadog.conf\""
@molinto
Copy link

molinto commented Jun 24, 2016

Thanks for this.
Do I actually put in the YOUR_API_KEY in this file please?

Thanks

@ayush
Copy link

ayush commented Oct 14, 2016

Wow, it's 2016 and your post still works exactly as described. Thanks!

@lukas-gitl
Copy link

lukas-gitl commented Jan 26, 2017

This works pretty well! I changed the last section to

        91setup_datadog:
            command: "sh -c \"sed 's/api_key:.*/api_key: {{DATADOG_API_KEY}}/; s/\\# tags:.*/tags: {{ENVIRONMENT}}/' /etc/dd-agent/datadog.conf.example > /etc/dd-agent/datadog.conf\""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment