In this blog, I will tell you how I setup my first agent, on a YaK deployed server. Of course, I will use YaK to deploy it.

What is dynatrace?

dynatrace is an observability platform which covers from infrastructure monitoring up to Real User Monitoring (RUM), including application and microservices, application security and business analytics.

My First Experience

My first experience with dynatrace was few years back when a customer complained about slow web service accesses. Fortunately, the system was instrumented with dynatrace and they were able to drill down to the exact java class that was causing this. The web service endpoint was protected by SAML authentication. With the right key words (ie. “SAML slow performance”) and the class name, it took only few minutes to find a KB article on MyOracleSupport and, even better, that a patch already exist for it. Then, it was only a matter of deploying it on one test environment. In that situation, dynatrace provided great help and a much faster resolution speed.

Deploy OneAgent

OneAgent is the only agent you will need to monitor your environment. It supports cloud and container platforms as well as most of the operating systems.

There is step by step interactive guide available to install it:

Once you click “Start installation”, it will ask for the target platform you want to install OneAgent on:

This is nice but does not fit my automation needs.

Deploy with YaK

YaK environment preparation can be done like described in a previous blog.

Then, I have to add the oneagent collection provided by dynatrace in my YaK environment. Link is provided in “Download Dynatrace OneAgent” (see previous screenshot).

Once I copied the archive in my YaK environment, I run this ansible galaxy command:

ansible-galaxy collection install dynatrace-oneagent-ansible-

On successful install, output will look like that:

Starting galaxy collection install process
[WARNING]: Collection at '/workspace/yak/collections/ansible_collections/yak/misc' does not have
a MANIFEST.json file, nor has it galaxy.yml: cannot detect version.
Process install dependency map
Starting collection install process
Installing 'dynatrace.oneagent:1.1.0' to '/workspace/yak/collections/ansible_collections/dynatrace/oneagent'
dynatrace.oneagent:1.1.0 was installed successfully

As there is no embedded playbook, I need to write a simple one which will call the role from the collection:

- name: Download OneAgent installer in specific version to a custom
    directory with additional OneAgent install parameters. Both linux_other
    and linux_arm have different user specified by platform args parameter.
  hosts: middleware_webserver
    - dynatrace.oneagent
    - encrypted_credentials.yml
    oneagent_download_dir: /home/ansible
      - --set-host-group=on.prem
    ansible_become: true
    - import_role:
        name: oneagent

This is based on examples provided in collection (in dynatrace/oneagent/roles/oneagent/examples/).

encrypted_credentials.yml is a variable files containing my dynatrace environment URL as well as a Paas token:

oneagent_environment_url: https://**********
oneagent_paas_token: *********************************************************************************

It is good practice to encrypt it with Ansible Vault.

We need to generate the token for ansible to be able OneAgent directly from dynatrace. To do that, I go to left menu “Manage -> Access Token”. There, I click “Generate new token”. I named the token and select Paas template which will ensure all required scopes will be selected and authorized for that token:

Then, click “Generate token” and result will be present:

As they suggest, you have to backup it in a safe place. I copy and paste it in encrypted_credentials.yml in oneagent_paas_token variable.

Finally, I am ready to run the playbook. With YaK, it is as easy as this:

ansible-playbook oneagent.yml

After 2/3 minutes, installation completes and host is visible in dynatrace (Infrastructure -> Hosts):

Then, with JMeter, I run a bit of load on the deployed web application, so that I am able to see data:

In “Technologies and processes” menu, I can see that OneAgent discovered WildFly:

In further dynatrace blogs, I will try to go deeper on dynatrace features.