SAP Cloud Integration – Artifact’s runtime status Monitoring using Dynatrace

Cloud Integration provides various application programming interfaces (APIs) for accessing various aspects of the platform. These APIs are mainly SDK APIs (or Java APIs) and OData APIs. OData APIs are implemented as REST API and use the Open Data Protocol as a technical protocol.

You can find the OData APIs on SAP API Business Hub. The Integration Content API details are available at:  https://api.sap.com/api/IntegrationContent/overview. This provides not only API reference but also a Sandbox opportunity to test the APIs.

API to GET Runtime Status of Deployed Artifacts

Run Time Status API provides the following three end points to get run time status of the currently deployed integration artifacts:

No Method Resource Path Resource Path
1 POST /DeployIntegrationDesigntimeArtifact?Id='<bundleId>’&Version='<version>’ Get taskId of currently deployed integration flow. The OData API sends back a response that contains the taskId
2 GET /BuildAndDeployStatus(TaskId='<taskid>’) Using the taskId make an OData call to get the build and deploy status of currently deployed integration flow
3 GET /IntegrationRuntimeArtifacts(‘<bundleId>’) Get runtime status of currently deployed integration flow

Runtime Status API

GET IntegrationRuntimeArtifacts OData end point response indicates if a deployed artifact is ready to operate or not. It indicates the following possible statuses:

  • Started: The artifact is ready to be used and it is in final state
  • Error: The artifact requires attention by the administrator, and it is in final state
  • Starting: The artifact is in the process of being deployed and it is in an intermediate state. If deployed, it is being started
  • Stopping: The artifact is in the process of being stopped and it is in an intermediate state. If stopped, it is being undeployed

API Reference is available at the following URL:

https://api.sap.com/api/IntegrationContent/resource

Monitor the Status of Integration Runtime Artifacts

I am going to use IntegrationRuntimeArtifacts API end point to monitor the status of the currently deployed Integration artifacts in Dynatrace.

Dynatrace is all-in-one monitoring platform which provides an answer about the availability and performance of applications, their underlying infrastructure, and the experience of end users. Dynatrace provides various capabilities for monitoring and analysing the performance of all aspects of an enterprise application environment.

Dynatrace Synthetic Monitoring capability makes it easy to monitor the availability and performance of an applications. Availability is the success rate at a given instant or time-period that indicates if application is fully functional and available.

Dynatrace offers the following types of synthetic monitors: single-URL browser monitors, browser clickpaths, and HTTP monitors.

Synthetic HTTP monitors can be used to check the availability of a resources—website or an API endpoint. In this blog I am going show how to use Dynatrace HTTP monitor and Integration Run Time API to monitor the status of currently deployed Integration artifacts.

Find out the IDs of the artifacts

First, we need to find out the Ids of the artifacts need to be monitored. You can use the IntegrationRuntimeArtifacts API to get deployed integration artifacts Ids. I used Postman to get the list of Ids. For example,  https://{Account and Host Details}:443/api/v1/IntegrationRuntimeArtifacts?$select=Id,Type

These Ids required to get the status of the Runtime Artifact. This API only gives the Ids of the deployed artifacts:

You can also use Web UI to get an integration flow ID at design time.

GET IntegrationRuntimeArtifacts by ID

Once you have the artifact ID, you can call GET IntegrationRuntimeArtifacts API to find out the status of an artifact. For example, For example,  https://{Account and Host Details}:443/api/v1/IntegrationRuntimeArtifacts(‘artifact_ID‘)

GET IntegrationRuntimeArtifacts API response gives the artifact status as mentioned above. It is one of Started, Error, Stopping or Stopping. In the above API example, the artifact status is STARTED. In this blog I am going to show how to monitor artifact status in Dynatrace.

Dynatrace Synthetic Monitoring

Dynatrace Synthetic Monitoring provides a capability to easily monitor the availability and performance of your applications. Availability indicates that if your application is fully functional and available at a given instant or time.

Dynatrace offers various types of Synthetic Monitors. For details, please visit the following URL:

https://www.dynatrace.com/support/help/how-to-use-dynatrace/synthetic-monitoring/general-information/types-of-synthetic-monitors

For this blog I am going to use HTTP monitors. HTTP monitors can be used to monitor the availability of your endpoints or perform simple HTTP checks for resource availability. I am going to configure GET IntegrationRuntimeArtifacts OData end point in HTTP monitor and check the status of the deployed artifact.

Create an HTTP Monitor

Step 1: Create a Dynatrace Monitor

  • From the Dynatrace menu, go to Synthetic → Create a synthetic monitor → Create an HTTP monitor.
  • Enter a suitable name for the synthetic monitor.

Step 2: Add Http Request

  • Provide the HTTP Request URL for the resource need to be monitored. For example, https://{Account and Host Details}:443/api/v1/IntegrationRuntimeArtifacts(‘artifact_ID‘)

  • Provide a suitable Name and select GET as a HTTP Method
  • Add HTTP request

Step 3: Set authentication/authorization

  • For this demo I just choose Basic S-User authentication. Other options are also available. The S-User credentials are stored in Dynatrace Credentials Vault.
  • Dynatrace also provides Additional Options such as pre or post execution scripts etc.

Step 4: Set Frequency and Location

  • Set up how frequently your HTTP monitor runs from each location. You can also set up your monitor to be executed on demand only. Location specifies the locations from which the monitor is executed.

Save and the HTTP monitor starts monitoring the artifact.

Dynatrace Dashboard

Login to the Dynatrace dashboard and Go to Synthetic  → <Select Synthetic Monitor>. Dynatrace will present various dashboard and graphs showing the availability status of the artifact. The following graphs shows the HTTP response status of the monitored artifact.

If the artifact is not available, the HTTP response code will be >=400 which is indicated by red in the above graph.

It also shows the time during which this artifact is not available.

HTTP Synthetic monitor will automatically generate a Problem in Dynatrace to report that the artifact is not available.

This problem notification can be used to send an email or generate a ServiceNow ticket.

Conclusion

By using Dynatrace Synthetic Monitoring capability and Integration Content API you can monitor the status of the deployed artifact. In this blog I just used out of box capabilities without utilising any of the Additional Option available in the Dynatrace Synthetic Monitor such as pre or post execution scripts or set additional headers or set rule for response validation. These options can be utilised to write more flexible and intelligent Synthetic Monitor.

Dynatrace also provide an option to send an email or create a ServiceNow ticket or Jira as a result of a problem incident.