Skip to content

Instantly share code, notes, and snippets.

@matesio
Created October 29, 2018 09:52
Show Gist options
  • Save matesio/64c55683ba298ab3f173bf2c826172e4 to your computer and use it in GitHub Desktop.
Save matesio/64c55683ba298ab3f173bf2c826172e4 to your computer and use it in GitHub Desktop.
monitoring elasticbeanstalk with datadog
files:
"/tmp/replace_datadog_api_key.sh" :
mode: "000700"
owner: root
group: root
content: |
#!/bin/bash
sed 's/api_key:.*/api_key: 438fa781126206d25ad66398f2d6f319 ' /etc/datadog-agent/datadog.yaml.example > /etc/datadog-agent/datadog.yaml
sed -i 's/# expvar_port:.*/expvar_port: 5005/' /etc/datadog-agent/datadog.yaml
sed -i 's/# cmd_port:.*/cmd_port: 5006/' /etc/datadog-agent/datadog.yaml
sed -i 's/.*logs_enabled:.*/logs_enabled: true/' /etc/datadog-agent/datadog.yaml
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"
91setup_datadog:
command: "/tmp/replace_datadog_api_key.sh ; rm /tmp/replace_datadog_api_key.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment