Skip to main content

Export and Import Integrations

You can use the integrations API to migrate integration configurations across your Moogsoft Enterprise instances, allowing you to swiftly set up new integrations while keeping previous configurations intact.

This example workflow combines queries to multiple endpoints to create an export/import workflow, exporting an integration from one instance and then importing it into another instance.

Before you begin

Before you start the workflow, ensure you have met the following requirements:

  • You have access to two separate instances of Moogsoft Enterprise and an integration on one of these.

  • You have running brokers on the destination instance.

  • You have the ID of the integration(s) you want to export from your first instance. The ID displays in the URL when you open the integration in your browser. For example, https:/example.com/#/integrations/integration-details/13 has the ID 13.

Export the integration

The first step is to export the integration's details. Using basic authentication, make a GET request to your first instance's /integrations/{integrationId} endpoint to retrieve its payload:

curl -k -u graze:graze https://localhost/integrations/api/v1/integrations/22

The payload in the response returns the integration's details. For example:

{
    "id": 3,
    "name": "DynatraceAPMPolling1",
    "type_id": "dynatrace_apm_lam",
    "version": "2.3",
    "config": {
        "config": {
            "filter": {
                "modules": [],
                "presend": "DynatraceApmLam.js",
                "dependencies": {
                    "lambot": [
                        "LamBot.js",
                        "DynatraceApmLam.js"
                    ],
                    "contrib": []
                }
            },
            "mapping": {
                "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"
                    }
                ],
                "catchAll": "overflow",
                "lambotOverridden": [
                    "custom_info.overflow",
                    "source"
                ]
            },
            "monitor": {
                "name": "DynatraceApm Lam Monitor",
                "class": "CDynatraceApmMonitor",
                "targets": {
                    "target1": {
                        "url": "https://localhost:8021",
                        "filter": {
                            "state": "InProgress",
                            "profileName": "nam",
                            "incidentRule": "rul"
                        },
                        "timeout": 120,
                        "password": "def",
                        "username": "abc",
                        "disable_certificate_validation": true
                    }
                },
                "max_retries": -1,
                "retry_interval": 60,
                "request_interval": 60
            },
            "constants": {
                "severity": {
                    "severe": 5,
                    "warning": 2,
                    "informational": 1
                }
            },
            "conversions": {
                "stringToInt": {
                    "input": "STRING",
                    "output": "INTEGER"
                },
                "sevConverter": {
                    "input": "STRING",
                    "lookup": "severity",
                    "output": "INTEGER"
                },
                "timeConverter": {
                    "input": "STRING",
                    "output": "INTEGER",
                    "timeFormat": "yyyy-MM-dd'T'HH:mm:ss.SSS"
                }
            }
        },
        "moolets": [],
        "type_id": "dynatrace_apm_lam",
        "version": "2.3",
        "category": "monitoring",
        "ha_profile": "active_passive",
        "description": "An integration which enables Moogsoft AIOps to ingest events from Dynatrace APM.",
        "display_name": "Dynatrace APM (Polling)"
    },
    "inputs": [
        {
            "key": "targets",
            "value": [
                {
                    "url": "https://localhost:8021",
                    "filter": {
                        "state": "InProgress",
                        "profile_name": "nam",
                        "incident_rule": "rul"
                    },
                    "password": "def",
                    "username": "abc"
                }
            ]
        },
        {
            "key": "timing",
            "value": {
                "timeout": 120,
                "retry_interval": 60,
                "request_interval": 60
            }
        }
    ],
    "readonly": null
}

Import the integration

Now that you have the integration's details from the payload you can import them into your second instance and create a new integration.

Make a POST request to your destination instance's /integrations endpoint, using the whole payload from the GET request. You do not need to omit the id parameter as the POST request ignores it. For example:

curl -X POST \
https://instance2.com/integrations/api/v1/integrations \
-H 'Content-Type: application/json' \
-u phil:password123 \
-d '{
    "id": 3,
    "type_id": "dynatrace_apm_lam",
    "inputs": [
        {
            "key": "targets",
            "value": [
                {
                    "url": "https://localhost:8021",
                    "filter": {
                        "state": "InProgress",
                        "profile_name": "nam",
                        "incident_rule": "rul"
                    },
                    "password": "def",
                    "username": "abc"
                }
            ]
        },
        {
            "key": "timing",
            "value": {
                "timeout": 120,
                "retry_interval": 60,
                "request_interval": 60
            }
        }
    ],
    "name": "DynatraceAPMPolling1",
    "version": "2.3"
    }'

A successful response returns a payload containing the new integration's details.

Start the integration

Having exported the integration, the final step is to start it up.

Make a PUT request to your destination instance's /integrations/{integrationId}/status endpoint:

curl -X PUT \
https://instance2.com/integrations/api/v1/integrations/6/status \ 
-H 'Content-Type: application/json' \
-u phil:password123 \
-d '{
      "command": "start"
    }'

The integration is now ready to use on your second instance.