Last active
September 21, 2019 23:26
-
-
Save btamayo/ce6668c886b41947191bbc47b3e9e04f to your computer and use it in GitHub Desktop.
Revisions
-
btamayo revised this gist
Jun 27, 2018 . 1 changed file with 0 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -275,10 +275,6 @@ cp -r . /etc/datadog-agent/ Edit `/etc/datadog-agent/datadog.yaml` to add your API key. ### Configure a user: I didn't need to do this part since I have a specific user/group setup for my development machines, but this is to illustrate how you might. -
btamayo revised this gist
Jun 27, 2018 . 1 changed file with 53 additions and 9 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -252,31 +252,75 @@ cd $GOPATH/src/github.com/DataDog/datadog-agent # DD_API_KEY=<KEY HERE> ./bin/agent/agent -c bin/agent/dist/datadog.yaml ``` ## 5. Postinstall (optional): ### Move and/or copy files into expected directories This depends on your preferences, but this is how I decided to finalize my install: Move `$GOPATH/src/github.com/DataDog/datadog-agent/` into `/opt/` (to be compatible with normal package distributions). ```shell cd $GOPATH/src/github.com/DataDog/ mv datadog-agent /opt/ ``` Copy the config files into `/etc/datadog-agent` and edit as necessary: ```shell mkdir -p /etc/datadog-agent/ cd /opt/datadog-agent/bin/agent/dist cp -r . /etc/datadog-agent/ ``` Edit `/etc/datadog-agent/datadog.yaml` to add your API key. ### Post-install ### Configure a user: I didn't need to do this part since I have a specific user/group setup for my development machines, but this is to illustrate how you might. This is similar to how it's done in the [Dockerfile](https://github.com/DataDog/datadog-agent/blob/master/Dockerfiles/agent/Dockerfile). The difference here is that I didn't add it to the root group, but you can choose to do what you'd like. ``` # create user if it does not yet exist adduser --system --no-create-home --disabled-password --ingroup dd-agent dd-agent # Give permissions to relevant directories chown -R dd-agent:dd-agent /etc/datadog-agent/ /opt/datadog-agent/ /var/log/datadog/ chmod g+r,g+w,g+X -R /etc/datadog-agent/ /var/log/datadog/ ``` (To add `dd-agent` to the root group, you can do the following instead of the above `adduser` command, then `chown` accordingly): ``` adduser --system --no-create-home --disabled-password --ingroup root dd-agent chown -R dd-agent:root /etc/datadog-agent/ /opt/datadog-agent/ /var/log/datadog/ ``` With guidance from [this file](https://github.com/DataDog/datadog-agent/blob/master/omnibus/config/templates/datadog-puppy/systemd.service.erb), here's the systemd service for the puppy agent: ``` root@pxpi:~# cat /lib/systemd/system/datadog-agent.service [Unit] Description="Datadog Agent" After=network.target [Service] Type=simple PIDFile=/opt/datadog-agent/run/agent.pid User=dd-agent Restart=on-failure ExecStart=/opt/datadog-agent/bin/agent/agent start -p /opt/datadog-agent/run/agent.pid [Install] WantedBy=multi-user.target ``` For more post-install steps on Debian-ish systems, you can also take a look at the [omnibus postinstall script in the datadog agent repo](https://github.com/DataDog/datadog-agent/blob/master/omnibus/package-scripts/agent/postinst). -
btamayo revised this gist
Jun 27, 2018 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -113,7 +113,7 @@ time GOROOT_BOOTSTRAP=$HOME/go1.4 ./make.bash A successful output will look something like: ```shell root@pxpi:/usr/local/go/src# time GOROOT_BOOTSTRAP=$HOME/go1.4 ./make.bash Building Go cmd/dist using /root/go1.4. Building Go toolchain1 using /root/go1.4. @@ -133,7 +133,7 @@ sys 0m44.624s # go version: root@pxpi:/usr/local/go/src# go version go version go1.10.3 linux/arm ``` @@ -279,3 +279,4 @@ Edit `/etc/datadog-agent/datadog.yaml` to add your API key. ```shell datadog-agent start -c /etc/datadog-agent/datadog.yaml ``` -
btamayo revised this gist
Jun 27, 2018 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ I had trouble running the Datadog Agent (v6) on my Raspberry Pi. Here's what I d ## Sections: 1. [Installing Go](https://gist.github.com/btamayo/ce6668c886b41947191bbc47b3e9e04f#1-install-go-golang-without-gvm) (skip if you already have Go 1.9+) 2. [Install/build the Datadog Agent](https://gist.github.com/btamayo/ce6668c886b41947191bbc47b3e9e04f#install-datadog-agent) ## System Info: -
btamayo revised this gist
Jun 27, 2018 . 1 changed file with 21 additions and 15 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ I had trouble running the Datadog Agent (v6) on my Raspberry Pi. Here's what I d ## Sections: 1. [Installing Go](https://gist.github.com/btamayo/ce6668c886b41947191bbc47b3e9e04f#1-install-go-golang-without-gvm) (skip if you already have Go 1.9+) 2. [Building Datadog Agent](https://gist.github.com/btamayo/ce6668c886b41947191bbc47b3e9e04f#install-datadog-agent) @@ -137,7 +137,7 @@ root@rpi:/usr/local/go/src# go version go version go1.10.3 linux/arm ``` ### Set up your paths and environment variables: Add the following to your `.bashrc`, `.bash_profile`, `.zshrc`, or what have you. @@ -156,13 +156,15 @@ Don't forget to `source` it or reload your shell. Building for 32-bit ARM requires the Puppy variant of the datadog agent. See: https://github.com/DataDog/datadog-agent/issues/1069 ## 1. Install dependencies: - Python2.7 - invoke - Go 1.9+ - dep ### 1. Install system dependencies: This presumes you are root or have `sudo` access. Optionally what you already have: @@ -183,21 +185,21 @@ sudo apt-get install libsystemd-dev ``` ### 2. Installing `invoke`: ```shell pip install invoke ``` ### 3. Installing `dep`: Dep does not support ARM binaries. You must `go get` it. ```shell go get -u github.com/golang/dep/cmd/dep ``` The following should now work if `$GOPATH` is set up correctly. If it is not set up correctly, do so now. **Remember that `go env` will print out Go env vars which is not necessarily the same as your shell's.** ```shell @@ -210,7 +212,9 @@ Usage: "dep [command]" ## 2. Download/clone datadog agent source The current README's example states to clone the directory (especially if you would like the `master` branch) but I'm guessing `go get -u github.com/DataDog/datadog-agent` should work as essentially the same: @@ -219,7 +223,7 @@ git clone https://github.com/DataDog/datadog-agent.git $GOPATH/src/github.com/Da ``` ## 3. Building the agent Building for 32-bit ARM requires the Puppy variant of the datadog agent. See: https://github.com/DataDog/datadog-agent/issues/1069 @@ -230,25 +234,27 @@ invoke deps invoke agent.build --puppy ``` Check if it runs: From https://github.com/DataDog/datadog-agent/blob/master/README.md#run: ```shell cd $GOPATH/src/github.com/DataDog/datadog-agent # Might error out unless you set an API key in # ./bin/agent/dist/datadog.yaml # You can also export it as `DD_API_KEY` # e.g. export DD_API_KEY=1234 ./bin/agent/agent -c bin/agent/dist/datadog.yaml # OR # DD_API_KEY=<KEY HERE> ./bin/agent/agent -c bin/agent/dist/datadog.yaml ``` ## 5. Final setup, optional: ### Move and/or copy files into expected directories (optional) This depends on your preferences, but this is how I decided to finalize my install: -
btamayo renamed this gist
Jun 27, 2018 . 1 changed file with 139 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,11 @@ I had trouble running the Datadog Agent (v6) on my Raspberry Pi. Here's what I did to get it running. ## Sections: 1. Installing Go (skip if you already have Go 1.9.4+) 2. [Building Datadog Agent](https://gist.github.com/btamayo/ce6668c886b41947191bbc47b3e9e04f#install-datadog-agent) ## System Info: @@ -132,6 +137,139 @@ root@rpi:/usr/local/go/src# go version go version go1.10.3 linux/arm ``` ### Setup your paths and environment variables: Add the following to your `.bashrc`, `.bash_profile`, `.zshrc`, or what have you. ```shell export PATH=$PATH:/usr/local/go/bin export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin ``` Don't forget to `source` it or reload your shell. --- # Install datadog-agent Building for 32-bit ARM requires the Puppy variant of the datadog agent. See: https://github.com/DataDog/datadog-agent/issues/1069 ## Development environment dependencies: - Python2.7 - invoke - Go 1.9+ ### Install deps: This presumes you are root or have `sudo` access. Optionally what you already have: ```shell # For all: sudo apt-get update # Python 2.7 sudo apt-get install python2.7-dev # Install snmpd -- not sure if this is needed for the Puppy agent sudo apt-get install libsnmp-base libsnmp-dev snmp-mibs-downloader # Install systemd dev -- again, not sure if this is built against on the Puppy agent sudo apt-get install libsystemd-dev ``` ### Install `invoke`: ```shell pip install invoke ``` ### Installing `dep`: Dep does not support ARM binaries. You must `go get` it. ```shell go get -u github.com/golang/dep/cmd/dep ``` The following should now work if `$GOPATH` is set up correctly. If it is not set up correctly, do so now. **Remember that `go env` will print out Go env vars which is not necessarily the same as your shell's.** ```shell root@pxpi:/etc/datadog-agent# dep Dep is a tool for managing dependencies for Go projects Usage: "dep [command]" [...] ``` ### Download/clone datadog agent source The current README's example states to clone the directory (especially if you would like the `master` branch) but I'm guessing `go get -u github.com/DataDog/datadog-agent` should work as essentially the same: ```shell git clone https://github.com/DataDog/datadog-agent.git $GOPATH/src/github.com/DataDog/datadog-agent ``` ### Building the agent Building for 32-bit ARM requires the Puppy variant of the datadog agent. See: https://github.com/DataDog/datadog-agent/issues/1069 ```shell cd $GOPATH/src/github.com/DataDog/datadog-agent invoke deps invoke agent.build --puppy ``` ### Running the agent Check if it runs: From https://github.com/DataDog/datadog-agent/blob/master/README.md#run ```shell cd $GOPATH/src/github.com/DataDog/datadog-agent # Might error out unless you set an API key in # ./bin/agent/dist/datadog.yaml ./bin/agent/agent -c bin/agent/dist/datadog.yaml ``` ### Final setup, optional: #### Move and/or copy files into expected directories (optional) This depends on your preferences, but this is how I decided to finalize my install: Move the executable to `/usr/local/bin`: ```shell cd $GOPATH/src/github.com/DataDog/datadog-agent/bin/agent/dist mv ./bin/agent/agent /usr/local/bin/datadog-agent ``` Copy the config files into `/etc/datadog-agent` and edit as necessary: ```shell mkdir -p /etc/datadog-agent/ cd $GOPATH/src/github.com/DataDog/datadog-agent/bin/agent/dist cp -r . /etc/datadog-agent/ ``` Edit `/etc/datadog-agent/datadog.yaml` to add your API key. #### Start the agent: ```shell datadog-agent start -c /etc/datadog-agent/datadog.yaml ``` -
btamayo created this gist
Jun 27, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,137 @@ # Background: I had trouble running the Datadog Agent (v6) on my Raspberry Pi. Here's what I did to get it running. ## System Info: **pxpi** is the Raspberry Pi's host name. ```shell root@pxpi:/etc/datadog-agent# uname -a Linux pxpi 4.14.50-v7+ #1122 SMP Tue Jun 19 12:26:26 BST 2018 armv7l GNU/Linux ``` ```shell root@pxpi:/etc/datadog-agent# cat /etc/*rel* /usr/lib/arm-linux-gnueabihf/libarmmem.so PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)" NAME="Raspbian GNU/Linux" VERSION_ID="8" VERSION="8 (jessie)" ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" ``` --- # 1. Install Go (Golang): without GVM **Note: I haven't tried gvm, but the corresponding guide is here: [https://github.com/tgogos/rpi_golang#2-with-go-version-manager-gvm](https://github.com/tgogos/rpi_golang#2-with-go-version-manager-gvm). The rest of this guide will show how to install Go without GVM.** Note: This is from [this fork](https://github.com/btamayo/rpi_golang) of [tgogos/rpi_golang](https://github.com/tgogos/rpi_golang), which has instructions on how to install Go version 1.10.3. ### Quick Summary: 1. Use the pre-built binary in the repo to install Go 1.4.3 2. Optionally use Go 1.4.3 to upgrade (build) Go 1.10.3 **This presumes you're the root user**. If you are not, you may need to append `sudo` to some of the following commands. Optionally, ensure that the following directories do not exist as they _may_ conflict with the process. - `/usr/local/go` - `$HOME/go1.4` ## 1. Clone the repo: ```shell git clone https://github.com/tgogos/rpi_golang.git cd rpi_golang/ ``` ## 2. Install either only 1.4.3 or upgrade to 1.10.3: ### For 1.4.3 only: If you have no intention of upgrading to 1.10.3, you can untar the binary in the repo into `/usr/local`. ```shell # untar into /usr/local tar -xzf go1.4.3.linux-armv7.tar.gz -C /usr/local # Add to shell and .bashrc export PATH=/usr/local/go/bin:$PATH echo "export PATH=/usr/local/go/bin:$PATH" >> $HOME/.bashrc # go version should now output something go version # If you're happy with 1.4, you can stop at this point. ``` You're done! ### For 1.10.3: If you would like to upgrade to 1.10.3, follow this to untar the binary from the repo into a different location, and use it to bootstrap the build: Run `rm -rf /usr/local/go` if you accidentally made this directory already. ```shell # We use the 1.4 binary in the repo to bootstrap building 1.10: # While still in rpi_golang directory, make the alternate directory: mkdir -p $HOME/go1.4 # Untar into that directory tar -xzf go1.4.3.linux-armv7.tar.gz -C $HOME/go1.4 --strip-components=1 # Download and untar the 1.10.3 src into /usr/local wget https://dl.google.com/go/go1.10.3.src.tar.gz tar -xz -C /usr/local -f go1.10.3.src.tar.gz ``` #### Build 1.10.3: ```shell cd /usr/local/go/src time GOROOT_BOOTSTRAP=$HOME/go1.4 ./make.bash ``` #### Output: A successful output will look something like: ```shell root@rpi:/usr/local/go/src# time GOROOT_BOOTSTRAP=$HOME/go1.4 ./make.bash Building Go cmd/dist using /root/go1.4. Building Go toolchain1 using /root/go1.4. Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1. Building Go toolchain2 using go_bootstrap and Go toolchain1. Building Go toolchain3 using go_bootstrap and Go toolchain2. Building packages and commands for linux/arm. --- Installed Go for linux/arm in /usr/local/go Installed commands in /usr/local/go/bin real 8m42.421s user 18m36.579s sys 0m44.624s # go version: root@rpi:/usr/local/go/src# go version go version go1.10.3 linux/arm ``` # Install datadog-agent //