# Overview

Dynatrace AppMon provides deep application monitoring and performance lifecycle management. The Dynatrace APM Plugin connects with the Dynatrace APM Plugin LAM and pushes the triggered incidents to it. The received incidents are then forwarded to Moogsoft AIOps. Therefore, in order to fetch incidents from Dynatrace APM, the  Dynatrace APM plugin must be installed on the Dynatrace server, and the Dynatrace APM Plugin LAM must be configured at Moogsoft AIOps end.

See Dynatrace APM Plugin for UI configuration instructions.

# Process Overview

1. The Dynatrace APM Plugin LAM reads the configuration from the  dynatrace_apm_plugin_lam.conf  file.
2. The Dynatrace Plugin pushes the incidents to Dynatrace APM Plugin LAM in JSON format.
3. The Dynatrace APM Plugin LAM parses the incidents and submits it to Extractor.
4. The Extractor is responsible for handling JSON strings and extracting alerts from it.
5. The alerts are parsed and converted into normalized Moogsoft AIOps alerts.
6. The normalized alerts are then published to MooMS bus.

# Installing the Dynatrace APM Plugin

### Note

To install Dynatrace Plugin:

1. Copy the Moogsoft Alert plugin moogsoft-actionplugin-1.0.jar to a desired location on the machine where you can open the Dynatrace Client.
2. Open the Dynatrace Client.

3. Click on Tools , then select Manage Plugins

4. Click on Install Plugin. A dialog box appears. Now browse and select the plugin jar moogsoft-actionplugin-1.0.jar that you copied in the first step, and click on Open .

5. A confirmation dialog box appears, click on OK . The plugin is installed on the Dynatrace Server.

6. Check if the Moogsoft Alert Plugin is present in the Installed Plugins tab.

7. Double click on Moogsoft Alert Plugin, and enter the details in the Configure plugin properties dialog.

• Moog Rest Url : Enter the URL of the Dynatrace APM Plugin LAM along with its default port i.e. 48004, e.g. http://localhost:48004.
• Enable Proxy : Select this if communication is to be routed through a proxy. After selecting it other fields requiring the proxy details are displayed.
• Proxy Host : Enter the IP address of the proxy.
• Proxy Port : Enter the port of the proxy.
• Enable Proxy Authentication : Select this if the proxy requires an authentication. After selecting it other fields requiring proxy authentication details are displayed.

• Proxy User : Enter the username for proxy authentication.
• Proxy password : Enter the password of user name given in the Proxy User field.
• Enable SSL : Select this if you want to establish a secured SSL connection. If you enable SSL, then use https instead of http in Moog Rest Url field. e.g. https://localhost:48004

• Trusted Certificate File : Enter the name of the server certificate file here, e.g. sever.crt. The certificate name entered here should be copied to the location C:\Program Files\Dynatrace\Dynatrace 6.5\server. Alternatively, the user can save the certificate at any desired location, but then the path where the server certificate file is present is also to be given, e.g. c:\users\desktop\sslcertificate\server.crt
• Enable Client Authentication : Select this to enable client authentication.
• SSL KeyFile : Enter the name of the key file here, e.g. client.key. The name entered here should be copied to the location C:\Program Files\Dynatrace\Dynatrace 6.5\server. Alternatively, the user can save the key file at any desired location, but then the path where the key file is present is also to be given, e.g. c:\users\desktop\sslcertificate\client.key
• SSL CertFile : Enter the name of the client certificate file here, e.g. client.crt. The name entered here should be copied to the location C:\Program Files\Dynatrace\Dynatrace 6.5\server. Alternatively, the user can save the certificate at any desired location, but then the path where the client certificate file is present is also to be given, e.g. c:\users\desktop\sslcertificate\client.crt

### Note

In the above mentioned path, Dynatrace 6.5 will be replaced by Dynatrace 7.0 for Dynatrace 7 and subsequently if any other version is installed, then it will change to the version of Dynatrace installed

8. Set the required log level in the log level field. By default, it is set to INFO.
9. Select the visibility of the fields in the corresponding row of the field in the Visibility column.  The visibility of a field governs whether the field is read only or hidden or editable, for the Moogsoft Alert Plugin during defining an action for an incident rule. The following 3 options are available:
• hidden : Selecting hidden here will not display the respective field in the Moogsoft Alert plugin while defining an action for an Incident Rule. The value that is set in the hidden fields during installation will be used as it is while defining an action. The only difference will be that the user will not be able to see the hidden fields.
• read : Selecting read will make the field read-only, and the user will not be able to make any changes to the field while defining an action for an Incident Rule. The values set for read-only fields during installation will be used as it is while defining an action.
• edit : Selecting edit enables the editing of value of field while defining an action. The user will be able to edit the value of the fields set to edit while defining the action.
10. Click on Apply and then OK to save the configuration.

The Moogsoft Alert plugin is cofigured for use on the Dynatrace server.

The log file of the plugin can be viewed at the location C:\Program Files\Dynatrace\Dynatrace 6.5\log\server in the Dynatrace Server. The name of the log file is com.moogsoft.dynatraceapm.CActionPlugin.action.0.0.log.

Alternatively, it can also be viewed from the Dynatrace Client. To view the log file from Dynatrace Client :

1. Open the Dynatrace Client and click on Help , then click on System information . The System Information tab opens.

2. Expand the Dynatrace Server e.g. vd-nsez-mgst03 as shown in the below screenshot, and double click on com.moogsoft.dynatraceapm.CActionPlugin.action.0.0.log. This will show log files in the below section.

### Note

The log file will only be created when an incident is forwarded through the plugin

### Note

If there is an error and it has occurred multiple times, then the severe log corresponding to the error message is logged only once, along with the number of times the error occurred e.g.

"2017-06-21 11:06:11 SEVERE [C ActionPlugin@com.moogsoft.dynatraceapm.CActionPlugin.action ] Previous message was repeated 2 times".

# SSL Configuration

To configure SSL following configurations are required:

1. Create a new folder. Open a command prompt and navigate to the newly created folder.

2. Run the following command in the command prompt. A server.crt and a server.key file is generated in the above created folder.

openssl req -new -x509 -days 365 -nodes -subj "/C=''/ST=''/L=''/O='moogsoft'/OU=''/CN=localhost" -out server.crt -keyout server.key > /dev/null 2>&1


### Note

In the above command, for the part /CN=localhost, enter the hostname of the machine where Dynatrace APM Plugin LAM is running, instead of localhost

### Note

Copy the generated certificates to the machine where Dynatrace APM Plugin LAM is running

3. Enter the following parameters in the monitor section of the Dynatrace APM Plugin LAM:
• Enter the port on which the SSL communication will be done in the field port . E.g. 48004
• Set the field use_ssl to true
• Enter the path of the directory, where the Server certificate is copied, in the path_to_ssl_files . E.g.  "../config"
• Enter the name of the Server certificate in the field ssl_key_filename . E.g. "server.key"
• Enter the name of the Server certificate in the ssl_cert_filename . E.g. "server.crt"
• Set the field use_client_certificates to true, if client authentication is required, then enter the client certificate e.g. client.crt in the field client_ca_filename .
• Select TLSv1.2 in ssl_protocols , if nothing is entered then TLSv1.2 is used as default protocol
4. Enter the server.crt certificate generated in the above command in the Trusted Certificate File field of the Moogsofte Alert Plugin.
5. Run the following command in the command prompt. A client.crt and a client.key file is generated in the above created folder. These certificates are required for client authentication. Therefore, generate these certificates only if client authentication is enabled.

openssl req -new -x509 -days 365 -nodes -subj "/C=''/ST=''/L=''/O='moogsoft'/OU=''/CN=CURLCLIENT" -out client.crt -keyout client.key > /dev/null 2>&1
6. If client authentication is enabled, then enter the name of the .key and .crt file genertaed using the above command in the SSL Key File and the SSLCertFile fields of the Moogsoft Alert Plugin.

The SSL is configured for Moogsoft Alert Plugin.

# Selecting the Moogsoft Alert Plugin for Forwarding a Triggered Incident

To select the Moogsoft Alert Plugin for forwarding a triggered incident:

1. Select Incidents in the left navigation tree, then select an Incident Rule, right click on it and select Edit Incident Rule .
2. Click on Advanced Configuration .
3. Click on Add . The Rule Action Editor dialog opens.

5. Select the Action Severity , and the Execution i.e. when should the triggered action be sent through the plugin.

6. Click on OK.

The Incident rule is configured to send the triggered incidents through Moogsoft Alert Plugin.

# Version Information

 Plugin Version Tool Version Tested? Expected to Work 1.0 Dynatrace Server 6.5, Dynatrace Server 7.0 Yes Yes

# Dynatrace APM Plugin LAM

The Dynatrace APM Plugin LAM is used to communicate with the Dynatrace APM Plugin. It is a copy of the REST LAM and configurations available here is same as that of a REST LAM. Refer the REST LAM document on how to configure the LAM for receiving data from the Dynatrace APM Plugin. The configuration for Dynatrace APM Plugin LAM is done in the dynatrace_apm_plugin_lam.conf file. The default configurations in the Dynatrace APM Plugin LAM is as follows:

## Monitor section

The following section is the monitor section of the Dynatrace APM Plugin LAM

config :
{

monitor:
{

name                         : "DynatraceAPMPlugin Lam Monitor",

class                        : "CRestMonitor",

port                         : 48004,

use_ssl                      : false,

#path_to_ssl_files           : "config",

#ssl_key_filename            : "server.key",

#ssl_cert_filename           : "server.pem",

#use_client_certificates     : false,

#client_ca_filename          : "ca.crt",

#auth_token                  : "my_secret",

#encrypted_auth_token    	 : "dfJtTQMGiFHfiq7sCmxguBt6Jv+eytkoiKCquSB/7iWxpgGsG2aez3z2j7SuBtKj",

#ssl_protocols               :
#[
#"TLSv1.2"
#]

authentication_type          : "none",

authentication_cache         : false,

accept_all_json              : true,

lists_contain_multiple_events: true,

rest_response_mode           : "on_receipt",

rpc_response_timeout         : 20,

event_ack_mode               : "queued_for_processing"
},

### Note

In the Monitor section, in the address field, enter the hostname of the machine where the Dynatrace APM Plugin LAM is running

### Note

The port given in the port field is an optional value that defaults to 48004

## Agent

agent:
{
name    : "Dynatrace APM Plugin"
#log    : "$MOOGSOFT_HOME/log/data-capture/dynatrace_apm_plugin_lam.log" }, The above example specifies: • name : This is the agent name, the events sent to MooMs are identified by the agent name. In this example the agent name is Dynatrace APM Plugin • log : In this instance, the Dynatrace APM Plugin LAM will write its ingress contents to  dynatrace_apm_plugin_lam.log  located at $MOOGSOFT_HOME/log/data-capture 

## Mapping

The following mapping section in the config file provides an example of mapping of the dynatrace_apm alert fields with the Moogsoft AIOps fields.

mapping:

{
catchAll:"overflow",
rules:
[
{ name: "signature", rule:      "$key.systemProfile::$incidentRule.name" },
{ name: "source_id", rule:      "$serverName" }, { name: "external_id", rule: "$key.uuid" },
{ name: "manager", rule:        "Dynatrace APM" },
{ name: "source", rule:         "$serverName" }, { name: "class", rule: "$key.systemProfile" },
{ name: "agent", rule:          "$LamInstanceName" }, { name: "agent_location", rule: "$LamInstanceName" },
{ name: "type", rule:           "$incidentRule.name" }, { name: "severity", rule: "$severity", conversion: "sevConverter" },
{ name: "description", rule:    "$message" }, { name: "agent_time", rule: "$startTime.timestampInMs", conversion: "stringToInt" }
]
},
filter:
{
presend: "DynatraceApmPluginLam.js"
}

### Note

The signature field is used by the LAM to identify the correlated alerts. By default, here it is set to a combination of "key.systemProfile" and "incidentRule.name" fields. However, user can change it as per the requirement

### Note

Variables section is not required in Dynatrace APM Plugin LAM; a user can directly map the alert fields of dynatrace_apm alerts with moogsoft fields

## Constant and Conversion

The following section is the constant and conversion of the Dynatrace APM Plugin LAM

constants:
{
severity:
{
"Informational" : 1,
"Warning" 		: 2,
"Error"		    : 5
}
},
conversions:
{
sevConverter:
{
lookup: "severity",
input:  "STRING",
output: "INTEGER"
},
stringToInt:
{
input:      "STRING",
output:     "INTEGER"
}
},

## Quotes

In some instances, the attribute strings are quoted. Our JSON parser ignores it, but the standard requires quoting for all strings, so Moogsoft recommends that user quotes all strings.

A user may comment out lines by prefixing them with a hash.

## Starting the Dynatrace APM Plugin LAM

To start the Dynatrace APM Plugin LAM enter the following command:

service  dynatraceapmpluginlamd start

### Note

To stop the Dynatrace APM Plugin LAM enter the following command:

service  dynatraceapmpluginlamd stop

To view the status of Dynatrace APM Plugin LAM, enter the following command:

service  dynatraceapmpluginlamd status

You can also use a GET request to check the status of the Dynatrace APM Plugin LAM. The request uses the authentication type and header authentication token defined in the Dynatrace APM Plugin LAM configuration file . See Check the LAM Status in the REST LAM Configuration Guide for further information and examples.

# Version Information

 Plugin LAM Version Tool Version 1.0 -1.4 Dynatrace Server 6.5 & Dynatrace Server 7.0

## System Information

This LAM was tested on a system with the following configurations:

 CPU 2 core RAM 4 GB Operating System CentOS Linux release 6.7

The system must at least have the above mentioned system requirements to run the integration.