Dynatrace Integration using Script - v1

Dynatrace Integration using Script - v1

Dynatrace to SDP Integration Tool – Configuration Guide


What this Integration Does

This integration automatically connects Dynatrace with ServiceDesk Plus to keep your CMDB up to date. It regularly reads information from Dynatrace about your servers, applications, and related components, and reflects the same details in ServiceDesk Plus without manual effort. Any new components discovered in Dynatrace are added, existing ones are updated, and outdated entries are removed. This ensures your ServiceDesk Plus CMDB always shows an accurate and current view of your IT environment, helping your teams work with reliable data.


Prerequisites:  -

  1. Python 3.6 or above
    Ensure Python is installed and added to your PATH. Use python --version or python3 --version to verify.

  2. Required Python Libraries:

    • configparser (standard library)

    • os (standard library)

    • requests

    • urllib (standard library)

    • logging (standard library)

    • json (standard library)

    • ratelimit

  1. Install them using:

pip install requests ratelimit           

If the above command doesn't work, try installing them individually i.e, pip install ratelimit 
  1. Dynatrace and SDP Credentials:

    • Dynatrace Access token and Dynatrace URL.

    • SDP API Key and SDP URL.

      • To generate an SDP API Key, navigate to:
        ADMIN -> Integration Key -> New


1. Abstract

The Dynatrace–SDP Integration Tool enables automatic synchronization of Dynatrace-monitored entities into the SDP CMDB. Proper configuration is required to ensure secure access, accurate entity mapping, and consistent data population across systems.


2. Configuring Access Tokens and URLs

2.1 Dynatrace Configuration

To allow the integration tool to read entities from Dynatrace, an access token must be generated.

Steps to generate an access token:

  1. Log in to your Dynatrace environment.

  2. Navigate to Main Menu → Access Tokens.

  3. Generate a new access token with ReadEntities permission.

Dynatrace Hosted URL:
The Dynatrace environment URL typically follows the format:

https://<yourdomain>.live.dynatrace.com

Important:
If your Dynatrace URL contains app or any other subdomain, replace it with live to ensure successful API calls.

Configuration in config.properties:

[DYNATRACE] hosted_url = https://<yourdomain>.live.dynatrace.com access_token = <your-dynatrace-access-token>

Do not include a trailing slash (/) at the end of the URL.


2.2 ServiceDesk Plus (SDP) Configuration

The integration requires access to the SDP API using an API key.

Required details:

  • SDP hosted URL

  • SDP API key

Configuration in config.properties:

[SDP] hosted_url = https://<your-sdp-server> api_key = <your-sdp-api-key>

Do not include a trailing slash (/) in the URL.


3. Mapping Dynatrace Entities to SDP CIs

Dynatrace entities must be mapped to corresponding SDP CMDB CI types using API names.

This mapping is defined in the [CMDB] section.

Example

If Dynatrace Host entities should be created under the Computer CI type in SDP:

[CMDB] Host = cmdb_computer

Notes:

  • Only valid SDP CI API names should be used.

  • CI API names can be obtained from the URL of the CI list view in SDP.

  • New CI types can also be created in SDP and referenced here.


4. Configuring CI Relationships

Relationships between CIs are not auto-created and must be set up manually in SDP before configuration.

Procedure:

  1. Create the required CI relationships in SDP.

  2. Copy the generated relationship association API names.

  3. Configure them in the [CMDB] section.

Example Relationship Definitions:

Host_to_DataCenter = assoc_computer_houses_data_centers Process_to_Host = assoc_process_runs_computers Service_to_Process = assoc_service_runs_on_processes Application_to_Service = assoc_applications_runs_service

These mappings determine how Dynatrace entities are linked together in the SDP CMDB.


5. Field Mapping for Dynatrace Entities

Field mapping controls which Dynatrace attributes populate SDP CI fields or User Defined Fields (UDFs).

Each entity type has a dedicated configuration section:

  • [DataCenterFieldMappings]

  • [HostFieldMappings]

  • [ProcessFieldMapping]

  • [ServiceFieldMapping]

  • [ApplicationFieldMapping]


Example: Host Field Mapping

[HostFieldMappings] system.vendor = udf_manufacturer system.processor.model = udf_processor_name ipAddress = udf_ip_address macAddresses = udf_mac_address osVersion = udf_os bitness = udf_bitness

Explanation:

  • Left side: Dynatrace field name

  • Right side: SDP CI field or UDF name

Only the fields explicitly defined in these sections will be populated to SDP.

Note:
The integration tool automatically populates the name and description fields by default; therefore, they do not need to be included in the field mapping.


6. Recommendations

  • Ensure all required UDFs exist in SDP before enabling the integration.

  • Verify CI API names and relationship API names carefully.

  • Refer to:

    • Sample config.properties file

    • SDP CMDB API documentation

  • Validate mappings in a test environment before production rollout.

7. Execution  

After completing the configuration, run the script using one of the following commands:

 python Dynatrace_Integration.py
# or
python3 Dynatrace_Integration.py 

Ensure the script is run from its directory.


How to Schedule in Custom Script :-

1. Admin -> Custom Schedules
2. Choose Execute Script as the Executor
3. Specify the fileName (i.e, Dynatrace_Integration.py). make sure to place the file in the directory as mentioned in the Custom Schedule Page.
4. Choose the desired date and frequency

                  New to ADSelfService Plus?