Telegraf using Azure Monitor - Error 400 - metricnamespace

I’m attempting to access the Azure Monitor (Insights) to pull data to InfluxDB. I have setup telegraf to pull, registered the Enterprise App in Azure. Ubuntu 22.04.2, InfluxDB v2.7.1, All is updated via apt install & app upgrade.

However, when I attempt to start telegraf with the Inputs I receive the following error.

root@server:/etc/telegraf/telegraf.d# RESPONSE 400: 400 Bad Request
ERROR CODE: BadRequest
--------------------------------------------------------------------------------
{
  "error": {
    "additionalInfo": [
      {
        "type": "string",
        "info": "TraceId={ebdf91bd-ea9a-4e5e-b524-fd5ae7a52937}"
      },
      {
        "type": "string",
        "info": "ExceptionType=Microsoft.Online.Metrics.MetricsMP.Utilities.RPRequestFormatException"
      }
    ],
    "code": "BadRequest",
    "message": "Missing required metricnamespace params, requested QueryParams: api-version:2021-05-01"
  }
}

I did attempt to manually add the Metrics found here Azure Monitor supported metrics by resource type - Azure Monitor | Microsoft Learn for the Insight/Monitor but resulted in the same error when using metrics = "
The configs inputs file can be seen here.

What version of telegraf are you using? The version that comes with ubuntu or from our own apt repo?

Can you please provide the full telegraf logs and not some JSON response please? it would help narrow down where the error message is coming from and help to determine if you need to provide additional info.

It seems suspect that you have not specifyed any metrics in your resource_target as well.

The version of Telegraf is (1.27.2-1) from the Influx repository and was installed via the process found Install Telegraf | Telegraf 1.21 Documentation see screen shot below for installation / upgrade process.

I’m not sure why it’s suspect, I’m following the Influxdb telegraf.conf documentation which states if left blank it will pull all metrics (see next post). Perhaps I can test the metrics and see if a different error were to result. What documentation should I follow to specify particular metrics?

The error message that was received was from the --debug command being added when attempting to start the telegraf service telegraf -config-directory /etc/telegraf/telegraf.d --debug
FYI: I was able to get the Grafana Azure Monitor to pull results without issue, so I know the ID, Secrets are correct.

The log shows the following error

2023-07-13T16:17:42Z E! [telegraf] Error running agent: could not initialize input inputs.azure_monitor: error checking resource targets metrics validation: error getting metric definitions response for resource target /subscriptions/c4a1234-5678-abcd-123-1231231237c6/resourceGroups/RESGROUP1: error listing metric definitions for the resource target /subscriptions/c4a1234-5678-abcd-123-1231231237c6/resourceGroups/RESGROUP1: GET https://management.azure.com/subscriptions/c4a1234-5678-abcd-123-1231231237c6/resourceGroups/RESGROUP1/providers/Microsoft.Insights/metricDefinitions
--------------------------------------------------------------------------------
RESPONSE 400: 400 Bad Request
ERROR CODE: BadRequest

You can also see the documentation that shows the metrics instructions. Sorry for back to back post but it’s only allowed to post single images per post.

Why is this error message different than the first one you pointed at?

Looking at the latest message it looks like azure client was unable to list metrics, hence my concern about you not providing any metrics. Does it work when you specify one so it skips this part of the code?

error getting metric definitions response for resource target /subscriptions/c4a1234-5678-abcd-123-1231231237c6/resourceGroups/RESGROUP1:
error listing metric definitions for the resource target /subscriptions/c4a1234-5678-abcd-123-1231231237c6/resourceGroups/RESGROUP1:
GET https://management.azure.com/subscriptions/c4a1234-5678-abcd-123-1231231237c6/resourceGroups/RESGROUP1/providers/Microsoft.Insights/metricDefinitions

It’s the same error from the original post (see telegraf.log below) but you wanted the non json so I just provided the error. Below is the full error and message within the log. Sorry for the confusion. Trying to provide as much valid data as possible without giving too much irrelevant information.

If I specify any of the metrics listed under Microsoft.Monitor or Microsoft.Insights I receive the same error.

Was this previously working on any version? or is this a new deployment?

New deployment. All from scratch starting with Ubuntu 22.04.2, InfluxDB2, telegraf and Grafana are the only installs on this machine.

If there is anything else you would like to try or provide, let me know. Not sure if a security update or API change broke something or it’s just this particular basic setup.