Set up OneAgent on containers for application-only monitoring
If you don't have access to underlying hosts, you can deploy OneAgent on containers for application-only monitoring. Follow the steps below to integrate OneAgent into the application image.
- Docker version 17.05+
Sign in to Docker with your Dynatrace environment ID as username.1docker login <environmentURL> -u <environmentID>
Enter your <PAAS_TOKEN> when prompted.
Add the following lines of code to the application image, after the last
FROMcommand:1COPY --from=<environmentURL>/linux/oneagent-codemodules:<TECHNOLOGY> / /2ENV LD_PRELOAD /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so
- Environment ActiveGate:
- Environment ActiveGate:
<TECHNOLOGY>is the OneAgent code module required for your application. Valid options are
sdk. To specify several code modules, separate them by hyphens (for example, use
go). Including specific technology-support options, rather than support for all technology options, results in a smaller OneAgent package.
Dynatrace OneAgent supports Alpine Linux–based environments.
Use this syntax:
1COPY --from=<ACTIVEGATE-ADDRESS>/linux/oneagent-codemodules-musl:<TECHNOLOGY> / /2ENV LD_PRELOAD /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so
Valid options here are
Build your application image.
Build the Docker image from your Dockerfile to use it in your Kubernetes environment.1docker build -t yourapp .
You can monitor your application containers with a different Dynatrace environment.
For OneAgent version 1.139+, if you have an existing application image where you have already added the OneAgent code modules for a specific Dynatrace environment, you can have the OneAgent report to another Dynatrace environment without rebuilding your application image.
For this, you need to make a call to the REST endpoint of your second Dynatrace environment. Don't forget to adapt the respective placeholders
In return, you get a JSON object that covers the required information that needs to be passed as an environment variable to the application container.
Make sure you set the environment variables of the application container as described below:
DT_CONNECTION_POINT: semi-colon separated list of
- optional Configure network zones
You can configure network zones as an environment variable:
See network zones for more information.
optional Configure a proxy address
In case you run an environment with proxy, you need to set the
DT_PROXYenvironment variable in the application container to pass the proxy credentials to OneAgent.
For Alpine Linux-based containers, you might need to update the
wgetshipped with the Alpine image to allow for proxy authentication for the download of OneAgent.
Each time you want to leverage a new version of Dynatrace OneAgent, you must rebuild your local OneAgent code modules and application image. Any newly started pods from this application image will be monitored with the latest version of OneAgent.
If you've specified a default OneAgent installation version for new hosts and applications using OneAgent update settings, your Kubernetes applications will be automatically monitored by the defined default version of Dynatrace OneAgent.
To uninstall OneAgent from application-only monitoring, just remove references from your application or Docker image and then redeploy the application.