Support Center Home


6. Customizing Azure Monitor DataSources

LogicMonitor DataSources that use the ‘Azure Insights’ collection method can be customized to collect additional metrics, different aggregation methods, or metrics with specific dimensions. The JSON path field in each datapoint controls which parameters get passed by LogicMonitor’s Cloud Collector into the Azure Monitor API request. 

Prerequisites

Customizing the LogicMonitor Datapoint Definition

To add dimensions to a new or an existing DataSource, complete the following steps:

1. Navigate to Settings > LogicModules > DataSources and search for the Azure API Management DataSource.

2. Click Add DataPoint.

3. Select the Normal datapoint option.

4. Enter the datapoint name and add the dimension parameter in the JSON path field.

The JSON path has a predictable format, with three possible values delimited by ‘.’:

metricName.aggregation.dimension

Where,

  •  metricName is the name of the Azure Monitor metric
  • aggregation is the (optional) desired aggregation

Note: ##primaryAggregation## can be used to dynamically pass in the Azure supported aggregation, as not all aggregations are supported for all metrics at all times. There are several tokens that you can use here. For a complete list of the supported tokens, see Tokens Available for Data Collection.

  • dimension is the (optional) desired dimension to filter the metric by in the following format:

    dimensionName:dimensionValue
  1. Select the desired metric from the list of the supported metrics in Azure Monitor for the resource. For example, select the Requests metric available in the resource Microsoft.ApiManagement/service.
  2. Select one of the dimensions available for the metric from the list, such as the GatewayResponseCode dimension, which provides the count of responses from the gateway based on the HTTP response code (e.g, 200 for HTTP OK response).

    Enter the following syntax in the JSON path for the new metric:
   Requests.##primaryaggregation##.GatewayResponseCode:200

The aggregation type available for the Requests metric is Total. So, the aggregation type Total will replace the token ##primaryaggregation## in the expression and give you the count of successful responses from the gateway.

  1. Click Save to save the metric definition.
  1. Click Save to save the updated DataSource.

Dimensions in Metrics

Simple metric data such as request count does not provide sufficient context for the collected values. Dimensions are name-value pairs that carry supplementary data to describe the metric value. 

For example, an Azure API Management service metric – FailedRequests supports the dimension Location. So with the Location dimension, you can view the failed requests across all the locations or for an individual location.

The Azure API Management (APIM) service is a hybrid,multi-cloud management platform for APIs across all environments. Azure Monitor provides several useful multi-dimensional metrics for the Azure API Management service. 

Creating an Azure API Management Instance

To create an instance, complete the following steps:

  1. To  create an Azure API Management instance, run the following Azure CLI commands:
  az group create --name apim-rg --location centralus

  az apim create --name lm-apim --resource-group apim-rg \
     --publisher-name LM --publisher-email [email protected] \
     --no-wait

Note: The Azure quickstart guide describes several other alternatives for creating an APIM instance such as the management portal, PowerShell, and ARM template.

  1. Wait for 30 to 40 minutes to allow the Azure API Management service to be created and activated. Use the following command to record the current status of the API:
  az apim show --name lm-apim --resource-group apim-rg --output table

  1. On the Azure management portal, select the API Management service that you just created. You will find the Echo API, which is created by default when you create a new Azure API Management instance.

Note: You can use the Echo API to test the metrics.

Once you have created an instance, you can configure the APIM DataSource in LogicMonitor to ingest a multi-dimensional metric. 

Inspecting the Metric

Now that you have an API Management instance and LogicMonitor recording the metrics, let’s generate some metrics from the API Management service.

1. On the API Management service, navigate to APIs > Echo API. Click Retrieve resource GET endpoint and click on
the Test tab.

2. Use the integrated test console to send a few HTTP requests to the service.

3. In LogicMonitor, navigate to the Resources page, and select your API Management resource.

4. Click on the Raw Data tab where you will find the new metric and the aggregated values.

5. To view the request that LogicMonitor made to fetch the value of the new metric, click Poll Now and scroll to the Raw Request/Response section.

You will find the API request from LogicMonitor and the response from Azure Monitor as displayed in the following image:

In This Article