Last active
September 2, 2018 03:32
-
-
Save miketheman/71b6c2ffa9d62400fd81cc0e289de652 to your computer and use it in GitHub Desktop.
Datadog Agent 5.x Service on Raspberry Pi
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
DD_API_KEY=<REPLACE> sh -c "$(curl -L https://raw.githubusercontent.com/DataDog/dd-agent/master/packaging/datadog-agent/source/setup_agent.sh)" | |
sudo mkdir /opt/datadog-agent | |
sudo cp -r ~/.datadog-agent/* /opt/datadog-agent | |
path=$HOME | |
path=${path//\//\\\/} | |
sedcmd="s/$path\/.datadog-agent/\/opt\/datadog-agent/g" | |
for i in /opt/datadog-agent/venv/bin/*; do echo $i; sudo sed -i $sedcmd $i; done | |
cd /opt/datadog-agent/venv/local/ | |
for i in *; do echo $i; sudo rm $i && sudo ln -s ../$i $i; done | |
sudo vi /opt/datadog-agent/start_agent.sh | |
#### Contents: | |
#!/bin/sh | |
PATH=/opt/datadog-agent/venv/bin:/opt/datadog-agent/bin:$PATH | |
exec /opt/datadog-agent/venv/bin/supervisord -c /opt/datadog-agent/agent/supervisor.conf | |
### | |
sudo useradd -r datadog | |
sudo usermod -G video datadog ## needed for certain system accesses, namely VCHI (GPU temperature) | |
sudo chown datadog:datadog -R /opt/datadog-agent | |
sudo chmod ug+x /opt/datadog-agent/start_agent.sh | |
sudo vi /etc/systemd/system/datadog-agent.service | |
### Contents: | |
[Unit] | |
Description="Datadog Agent" | |
After=network.target | |
[Service] | |
Type=forking | |
User=datadog | |
WorkingDirectory=/opt/datadog-agent | |
ExecStart=/opt/datadog-agent/start_agent.sh | |
ExecStop=/opt/datadog-agent/venv/bin/supervisorctl -c /opt/datadog-agent/agent/supervisor.conf shutdown | |
[Install] | |
WantedBy=multi-user.target | |
### | |
sudo systemctl daemon-reload | |
sudo systemctl enable datadog-agent.service | |
sudo systemctl start datadog-agent.service | |
sudo /opt/datadog-agent/bin/agent status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment