Last active
September 23, 2018 02:07
-
-
Save hac-madkudu/43fd3da60eb169033d51fe5913936d89 to your computer and use it in GitHub Desktop.
Datadog Agent 6x on Elastic Beanstalk
This file contains hidden or 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
# .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 clean all; yum -y makecache; yum -y install datadog-agent" | |
91setup_datadog: | |
test: '[ ! -e /etc/datadog-agent/datadog.yaml ]' | |
command: "sh -c \"sed 's/api_key:.*/api_key: YOUR_API_KEY/' /etc/datadog-agent/datadog.yaml.example > /tmp/datadog.yaml\"" | |
92copy_datadog: | |
test: '[ ! -e /etc/datadog-agent/datadog.yaml ]' | |
command: "cp /tmp/datadog.yaml /etc/datadog-agent/datadog.yaml" |
This file contains hidden or 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
#!/bin/bash | |
# .ebextensions/datadog/hooks/99start_datadog.sh | |
if [ -e /opt/datadog-agent/bin/agent/agent ] && [ -e /etc/datadog-agent/datadog.yaml ] && (( $(ps -ef | grep -v grep | grep datadog-agent | wc -l) == 0 )); then | |
start datadog-agent | |
fi |
This file contains hidden or 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
#!/bin/bash | |
# .ebextensions/datadog/hooks/99stop_datadog.sh | |
if [ -e /opt/datadog-agent/bin/agent/agent ] && [ -e /etc/datadog-agent/datadog.yaml ] && (( $(ps -ef | grep -v grep | grep datadog-agent | wc -l) > 0 )) ; then | |
stop datadog-agent | |
fi |
This file contains hidden or 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
[datadog] | |
name = Datadog, Inc. | |
baseurl = https://yum.datadoghq.com/stable/6/x86_64/ | |
enabled=1 | |
gpgcheck=1 | |
gpgkey=https://yum.datadoghq.com/DATADOG_RPM_KEY.public |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment