Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Datadog Agent 5.x Service on Raspberry Pi
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