new-relic-setup/setup.sh

29 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
# Author : NTT Data AG
# Date : 16-05-2023
# Installs dynatrace oneagent on target machine
echo "Installing dynatrace oneagent"
show_help() {
cat <<EOF
Usage: $0 <dynatrace_token>
EOF
}
if [ -z "$1" ]; then
echo "ERROR: no token provided."
show_help
exit 1
else
echo "Downloading oneagent..."
wget -O Dynatrace-OneAgent-Linux-1.265.137.sh "https://elw69065.live.dynatrace.com/api/v1/deployment/installer/agent/unix/default/latest?arch=x86&flavor=default" --header="Authorization: Api-Token $1"
echo "Verfiying signature"
# TODO: add grep so this script is oneagent version agnostic
wget https://ca.dynatrace.com/dt-root.cert.pem ; ( echo 'Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha-256"; boundary="--SIGNED-INSTALLER"'; echo ; echo ; echo '----SIGNED-INSTALLER' ; cat Dynatrace-OneAgent-Linux-1.265.137.sh ) | openssl cms -verify -CAfile dt-root.cert.pem > /dev/null
echo "Running dynatrace oneagent"
sudo Dynatrace-OneAgent-Linux-1.265.137.sh --set-infra-only=false --set-app-log-content-access=true
echo "Please restart processes you want to monitor"
fi