Can we use the same Dynatrace OneAgent installer in two different environments? That was the question posed by a customer recently.
Let’s see how it’s done…
- A Dynatrace account. Sign up for a free 15 day trial here.
By default, the OneAgent installer you download from your tenant is predefined to point to that tenant. In most cases this works perfectly and is the best way to install the OneAgent (lowest effort).
However, your organisational policy or workflow may demand that you use the same OneAgent installer for two (or more tenants). One example is using the same binary in a pipeline where the OneAgent will point at a preproduction tenant or a production tenant.
The default OneAgent install commands look like this:
wget -O Dynatrace-OneAgent-Linux-VERSION.sh "https://abc123.live.dynatrace.com/api/v1/deployment/installer/agent/unix/default/latest?Api-Token=def456&arch=x86&flavor=default sudo /bin/sh Dynatrace-OneAgent-Linux-VERSION.sh APP_LOG_CONTENT_ACCESS=1
To reconfigure the OneAgent, there are 3 additional (mandatory) parameters to pass during the install.
SERVERvariable is the full URL to the tenant eg.
TENANTvariable is the tenant part of the URL eg.
TENANT_TOKENis a variable which should be considered secret and private. Encrypt as you would with any other password.
Retrieve Your TENANT_TOKEN
A REST call is necessary to retrieve your
Api-Token needs to have
To generate one, go to Settings > Integration > Platform as a Service
Put It All Together
So, assuming the following:
SERVER=https://abc123.live.dynatrace.com TENANT=abc123 TENANT_TOKEN=9876hjk
All you need to do is append them to the installer line:
wget -O Dynatrace-OneAgent-Linux-VERSION.sh "https://abc123.live.dynatrace.com/api/v1/deployment/installer/agent/unix/default/latest?Api-Token=def456&arch=x86&flavor=default sudo /bin/sh Dynatrace-OneAgent-Linux-VERSION.sh SERVER=https://abc123.live.dynatrace.com TENANT=abc123 TENANT_TOKEN=9876hjk APP_LOG_CONTENT_ACCESS=1