The automation plugin enables FULL Automation of Dynatrace by leveraging the REST interfaces of the Dynatrace AppMon Server. The automation plugin includes Maven goals to execute the following actions on the Dynatrace AppMon Server:
- Activate Configuration: Activates a configuration within a system profile
- Enable/Disable Profile
- Stop/Restart Server
- Start/Stop Session Recording: Returns the actual recorded session URI
- Start/Stop Test: Start returns testrun id, allowing to inject it into Dynatrace agent parameters and use to finish test
- Installation
- Prerequisites
- Manual Installation
- Configuration
- Available Maven goals
- Additional Resources
- Dynatrace Application Monitoring version: 7+ (builds that support older AppMon releases can be found on the Releases page)
- Maven 3+
Plugin library is available in maven central repository (starting with version 7.0.0).
- Define properties for the Dynatrace goals as shown in pom.xml from the sample package
- Invoke your maven goals, e.g.: mvn com.dynatrace.diagnostics.automation:dynatrace-maven-plugin:startRecording
The Dynatrace maven plugin has the following identification: (pluginGroupId:pluginArtifactId:pluginVersion): mvn com.dynatrace.diagnostics.automation:dynatrace-maven-plugin:7.0.0
In order to build the plugin, Maven environment is needed to be configured in your system. Then you should be able to build and install package by executing mvn install
.
Jar file should be available in target
folder
A full example can be seen in the pom.xml as part of the project available in examples
folder.
Using plugin properties:
<properties>
<!-- Setting default values for Dynatrace Maven goals that operate on a system profile -->
<dynaTrace.username>admin</dynaTrace.username>
<dynaTrace.password>admin</dynaTrace.password>
<dynaTrace.serverUrl>http://localhost:8020</dynaTrace.serverUrl>
<dynaTrace.systemProfile>GoSpace</dynaTrace.systemProfile>
<!-- This property will be used to store the session uri for e.g.: Start/Stop Recording -->
<dynaTrace.sessionUriProperty>dynaTrace.sessionUri</dynaTrace.sessionUriProperty>
<!-- Following is a list of properties for goal: startRecording -->
<dynaTrace.sessionName>My Stored Session</dynaTrace.sessionName>
<dynaTrace.sessionDescription>My stored Session Description</dynaTrace.sessionDescription>
<dynaTrace.recordingOption>all</dynaTrace.recordingOption> <!-- other options: violations|timeseries -->
<dynaTrace.sessionLocked>false</dynaTrace.sessionLocked>
<dynaTrace.appendTimestamp>false</dynaTrace.appendTimestamp>
</properties>
Now we can call the startRecording goal in the following way:
mvn com.dynatrace.diagnostics.automation:dynatrace-maven-plugin:startRecording
You can inject the Dynatrace agent as part of surefire unit testing in Maven pom.xml with settings similar to this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<argLine>-agentpath:"C:\Program Files\dynaTrace\dynaTrace 6.5.0\agent\lib\dtagent.dll"=name=Maven,server=localhost:9998</argLine>
</configuration>
</plugin>
Description of Available Maven Tasks
- enableProfile - Enables or disables a System Profile
- activateConfiguration - Activates a Configuration of a System Profile
- restartServer - Restarts a dynaTrace Server
- startRecording - Starts session recording for a specified system profile
- stopRecording - Stops session recording for a specified system profile
- startTest - Sets meta data information for the Test Automation Feature and provides the DtStartTest.testRunId necessary to support parallel builds. The DtStartTest.testRunId value needs to be passed to the agent instrumenting the JVM that's executing the tests.
- finishTest - Sets test status of test run to finished. Explicit test run can be marked as finished using dynaTrace.testRunId, if this property is not set then testRunId generated by preceding startTest goal will be used.
- Continuous Delivery & Test Automation
- Capture Performance Data from Tests
- Integrate Dynatrace in Continous Integration Builds
Previous versions: