# Moogsoft Docs

##### Configure the Dynatrace APM Polling LAM
###### Introduction

Dynatrace AppMon provides comprehensive application monitoring and performance lifecycle management. Moogsoft Dynatrace APM Polling LAM connects with Dynatrace AppMon, fetches incidents from it and forwards them to Moogsoft AIOps.

See Dynatrace APM Polling for UI configuration instructions.

1. LAM reads the configuration from the dynatrace_apm_lam.conf file.

2. LAM will connect with Dynatrace APM REST API with the given host name.

3. The response is received with event data in the JSON format.

4. Dynatrace APM LAM has an option to filter event data based on the set filters. If filters are set, then the events are fetched based on the defined filters in the config file.

5. The incidents are parsed and converted into normalized Moogsoft AIOps events.

6. The normalized events are then published to MooMS bus.

###### Configuration

The incidents received from Dynatrace AppMon are processed according to the configuration in the dynatrace_apm_lam.conf file. The processed incidents are published to Moogsoft AIOps.

The configuration file contains a JSON object. At the first layer of the object, the LAM has a parameter called config, and the object that follows config has all the necessary information to control the LAM.

###### Monitor

The Dynatrace APM LAM takes the incidents from the Dynatrace AppMon. You can configure parameters here to establish a connection with Dynatrace AppMon:

###### General

Field

Type

Description

name and class

String

Reserved fields: do not change. Default values are DynatraceApm Lam Monitor and CDynatraceApmMonitor.

targets

JSON Object

A top-level container for which you can define one or more target Dynatrace APM sources. You can specify the configuration for each target. If you don't specify a request_interval the target uses the globally defined interval.

host_url

String

Enter theDynatrace APM Server Base URL or Host Namealong with its port.

You can use one of the below mentioned configuration for host_url:

1. If base_url is localhost:8020 and ssl is set to false, then the lam will form the host_url as http://localhost:8020/.

2. If base_url is localhost:8021 and ssl is set to true, then the lam will form the host_url as https://localhost:8021.

3. You can directly enter the host_url as http://localhost:8020. In this case, ssl should be false.

4. You can directly enter the host_url ashttps://localhost:8021. In this case, ssl can be true or false.

String

Enter the username and password for accessing Dynatrace AppMon server.

String

If the password is encrypted, then enter the encrypted password in this field and comment out the password field. At a time, either password or the encrypted_password field is used. If both the fields are not commented, then the field encrypted_password will be used by the Dynatrace APM LAM.

polling_interval

Integer

The polling time interval, in seconds, between the requests after which the event data is fetched from Dynatrace.

Default = 10 seconds. If 0 is entered, the time interval is set to 10 seconds.

max_retries

Integer

The maximum number of retry attempts to reconnect with Dynatrace in case of a connection failure.

Default = -1, if no value is specified, then there will be infinite retry attempts.

If the specified value is greater than 0, then the LAM will try that many times to reconnect; in case of any other value less than 0, max retries will set to default.

retry_interval

Integer

The time interval between two successive retry attempts.

Default = 60 seconds, if 0 is entered, the time interval will set to default.

timeout

Integer

The value in seconds to wait for a request to complete before timing out. If a timeout occurs, the LAM will wait for the next poll before trying again. Default value is 120 seconds.

request_interval

Integer

Length of time to wait between requests, in seconds. Can be overridden by request_interval in individual targets. Defaults to 60.

###### Filter

Field

Type

Description

filter

Object

Parameters to filter incidents:

• profileName: Enter the Dynatrace profile name.

• incidentRule: Enter the incident rule.

Setting both these parameters will fetch the incidents from the single incident rule of the profile. A profile name takes only one incident rule.

If only the profileName filter is set, then the incidents will be fetched from all the incident rules of the profile.

• state: The incidents with the mentioned state will be fetched from the Dynatrace AppMon server. At a time, you can give only one state. The states that can be given here are Created, InProgress and Confirmed.

• time_from: The incidents will be fetched from the time given here. The time should be given in the yyyy-mm-ddThh:mm:ss.SSSz format.

• time_till: The incidents will be fetched till the time given here. The time should be given in the yyyy-mm-ddThh:mm:ss.SSSz format.

The Dynatrace API is limited to 3 days, and therefore, the Dynatrace LAM will not fetch incidents which are older than 3 days. However, open incidents have no limits.

###### Secure Sockets Layer

Field

Type

Description

ssl

Boolean

Enter true here, to enable SSL Communication:

• ssl_keystore_file_path: Enter the path of the keystore file. This is the path where the generated keystore file is copied e.g. "/usr/local/dynatrace_ssl/KeyStore.jks".

• ssl_keystore_password: Enter the password of keystore. It is the same password that was entered when the keystore was generated.

###### Example

You can configure the Dynatrace APM LAM to retrieve events from one or more sources. The following example demonstrates a configuration that targets two Dynatrace APM sources. For a single source comment out the target2 section. If you have more than two sources, add a target section for each one and uncomment properties to enable them.

monitor:
{
name                                    : "DynatraceApm Lam Monitor",
class                                   : "CDynatraceApmMonitor",
request_interval                        : 60,
max_retries                             : -1,
retry_interval                          : 60,
targets:
{
target1:
{
url                             : "http://exampledynatraceapm1:8021",
user_name                       : "dynatraceapm_user1",
disable_certificate_validation  : false,
path_to_ssl_files               : "config",
server_cert_filename            : "server1.crt",
client_key_filename             : "client1.key",
client_cert_filename            : "client1.crt",
ssl_protocols                   : [ "TLSv1.2" ]
request_interval                : 60,
timeout                                                 : 120,
max_retries                     : -1,
retry_interval                  : 60,
filter                                                  :
{
#profilename: "",
#incidentRule: "",
#state: "",
#time_from: "",
#time_till: "",
}
}
target2:
{
url                             : "http://exampledynatraceapm2:8021",
user_name                       : "dynatraceapm_user2",
disable_certificate_validation  : false,
path_to_ssl_files               : "config",
server_cert_filename            : "server2.crt",
client_key_filename             : "client2.key",
client_cert_filename            : "client2.crt",
ssl_protocols                   : [ "TLSv1.2" ]
request_interval                : 60,
timeout                                                 : 120,
max_retries                     : -1,
retry_interval                  : 60,
filter                                                  :
{
profilename: "Profile1",
incidentRule: "Rule1",
state: "Created",
time_from: "2018-01-31T12:00:00.235-0700",
time_till: "2018-02-30T12:00:00.235-0700",
}
}
}
}
###### Agent and Process Log

Agent and Process Log allow you to define the following parameters:

• name: Identifies events the LAM sends to the Message Bus.

• capture_log: Name and location of the LAM's capture log file.

• configuration_file: Name and location of the LAM's process log configuration file.

###### Mapping

For incidents received in JSON format, you can directly map the (Incident) alarm/event fields of Dynatrace AppMon with Moogsoft AIOps fields. In the case of an event received in text format, the event is first tokenised in the Variable section, and then the tokenised event is mapped in the mapping section. The parameters of the received alarm/event are displayed in the Moogsoft AIOps according to the mapping done here:

mapping :
{
catchAll: "overflow",
rules:
[
{ name: "signature", rule:      "$systemprofile ::$rule" },
{ name: "source_id", rule:      "Dynatrace APM" },
{ name: "external_id", rule:    "$id" }, { name: "manager", rule: "Dynatrace APM" }, { name: "source", rule: "$source" },
{ name: "class", rule:          "$rule" }, { name: "agent", rule: "$LamInstanceName" },
{ name: "agent_location", rule: "$LamInstanceName" }, { name: "type", rule: "$state" },
{ name: "severity", rule:       "$severity", conversion:"sevConverter" }, { name: "description", rule: "$message" },
{ name: "agent_time", rule:     "\$start", conversion:"timeConverter"}
]
},
filter:
{
presend:"DynatraceApmLam.js"
}

The above example specifies the mapping of the Dynatrace AppMon incident fields with the Moogsoft AIOps fields. Data not mapped to Moogsoft AIOps Fields goes into "Custom Info".

The stringToInt is used to convert the data received in the string format into an integer format.

### Note

The signature field is used by the LAM to identify correlated incidents.

###### Constants and Conversions

Field

Description

Example

Severity and sevConverter

has a conversion defined as sevConverter in the Conversions section, this looks up the value of severity defined in the severity section of constants and returns back the mapped integer corresponding to the severity

severity:
{
"informational" : 1,
"warning"       : 2,
"severe"        : 5
}, 
sevConverter:
{
lookup : "severity",
input  : "STRING",
output : "INTEGER"
},

stringToInt

used in a conversion, which forces the system to turn a string token into an integer value

stringToInt:
{
input  : "STRING",
output : "INTEGER"
},

timeConverter

used in conversion which forces the system to convert time. If epoch time is to be used, then timeFormat mentioned in timeConverter should be commented. Otherwise, the user should provide the timeFormat

timeConverter:
{
timeFormat : "yyyy-MM-dd'T'HH:mm:ss.SSS",
input      : "STRING",
output     : "INTEGER"
}
###### Example

Example Constants and Conversions

constants:
{
severity:
{
"informational" : 1,
"warning"       : 2,
"severe"        : 5
},
},

conversions:
{
sevConverter:
{
lookup: "severity",
input:  "STRING",
output: "INTEGER"
},

stringToInt:
{
input:      "STRING",
output:     "INTEGER"
},

timeConverter:
{
timeFormat: "yyyy-MM-dd'T'HH:mm:ss.SSS",
input:      "STRING",
output:     "INTEGER"
}
},
###### Service Operation Reference

Process Name

Service Name

dynatrace_apm_lam

dynatraceapmlamd

Start the LAM Service:

service dynatraceapmlamd start

Stop the LAM Service:

service dynatraceapmlamd stop

Check the LAM Service status:

service dynatraceapmlamd status

If the LAM fails to connect to one or more Dynatrace APM sources, Moogsoft AIOps creates an alert and writes the details to the process log.

###### Command Line Reference

To see the available optional attributes of the dynatrace_apm_lam, run the following command:

dynatrace_apm_lam --help

The dynatrace_apm_lam is a command line executable, and has the following optional attributes:

Option

Description

--config

Points to a pathname to find the configuration file for the LAM. This is where the entire configuration for the LAM is specified.

--help

Displays all the command line options.

--version

Displays the component’s version number.

--loglevel

Specifies the level of debugging. By default, user gets everything. In common with all executables in Moogsoft AIOps, having it set at that level can result in a lot of output (many messages per event message processed).

In all production implementations, it is recommended that log level is set to WARN. This ensures only warning, error and fatal messages are recorded.