How to ingest Metrics into Azure Monitor via Webhhook.

Link, Jonas 0 Reputation points
2024-06-19T10:08:55.9433333+00:00

Hi,

I'm trying to ingest metrics vom Cribl to Azure Monitor managed service for Prometheus. For this I'm using a Webhook in Cribl with following data ingestion adress:
https://prometheus-cribl-dev-xxxx.germanywestcentral-1.metrics.ingest.monitor.azure.com/dataCollectionRules/dcr-67xxxxxxxxxxxxxxxx999209e539/streams/Microsoft-PrometheusMetrics/api/v1/write?api-version=2023-04-24

The Authentication with the Bearer token works, but now I'm getting the error message: Error":{"Code":"UnsupportedMediaType","Message":"Content-Type : application/json is not supported."
I already have set the Content-Type to "application/json" on the HTTP Header.

Do you have any idea how to fix this? Thanks!

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,986 questions
{count} votes

1 answer

Sort by: Most helpful
  1. shahsahib 0 Reputation points
    2024-07-07T15:33:11.0566667+00:00

    It seems like the issue is with the Content-Type header. Azure Monitor managed service for Prometheus likely expects a different content type for the data you're sending. Since you're working with Prometheus metrics, the expected content type might be application/x-protobuf instead of application/json.

    Much like crafting a perfect love shayari, where every word matters, the right content type is crucial here.

    Here's what you can do to fix the issue:

    1. Change the Content-Type header in your HTTP request from application/json to application/x-protobuf.
    2. Ensure the payload you are sending matches the format expected by Prometheus for protobuf data.

    Here's an example of what the header should look like:

    httpCopy code
    Content-Type: application/x-protobuf
    

    Make sure your data is encoded correctly according to the Prometheus protobuf format. If you're not familiar with how to format your data as protobuf, you might need to refer to the Prometheus documentation or use a library that can handle the conversion for you.

    By setting the correct Content-Type header and ensuring your data is in the correct format, you should be able to resolve the UnsupportedMediaType error.

    0 comments No comments