how to fix missing metricCounters.json for Azure Monitor Agent on Ubuntu 22.04

masaki 5 Reputation points
2023-08-10T17:37:42.0433333+00:00

I have set up a virtual machine (ubuntu 22.04) and Azure Monitor data collection rule, but the performance graphs are not showing. According to the output of Azure Monitor Agent Troubleshooter, metricCounters.json is missing. How can I fix this?

ERROR FOUND: metricCounters.json file is not found. Please check your perf counters configuration.

The DCR is associated with the virtual machine.

azuremonitoragent is running.

no heartbeat found in Log Analytics workspace.

The DCR config is not downloaded.

I found this error in /var/opt/microsoft/azuremonitoragent/log/mdsd.err:

Error: mdsd is terminated with exception: provided uri is invalid: /locations/japaneast/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/ChatGPTResourceGroup/providers/Microsoft.Compute/virtualMachines/ServerName/agentConfigurations?platform=linux&includeMeConfig=true&api-version=2022-06-02

I have already read these docs:

https://learn.microsoft.com/en-us/azure/azure-monitor/agents/azure-monitor-agent-troubleshoot-linux-vm

https://learn.microsoft.com/en-us/azure/azure-monitor/agents/use-azure-monitor-agent-troubleshooter

Please help.

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,805 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Monalla-MSFT 11,641 Reputation points
    2023-09-19T00:55:16.12+00:00

    @masaki - Welcome to Microsoft Q&A and thanks for reaching out to us.

    The error indicates that the Application Insights SDK is unable to find the metricCounters.json file, which is used to configure performance counters for your application.

    • Please ensure that the metricCounters.json file is present in the correct location. By default, this file should be in the root directory of your application.
    • If the metricCounters.json file is present and the configuration is correct, try restarting your application and see if the error persists.
    • Check the configuration of the Application Insights SDK to make sure that it is looking for the metricCounters.json file in the correct location. You can do this by checking the PerformanceCounters section of the ApplicationInsights.config or ApplicationInsights.json file.
    • If the error persists, try deleting the metricCounters.json file and recreating it with the correct configuration.

    Hope this helps. and please feel free to reach out if you have any further questions.


    If the above response was helpful, please feel free to "Accept as Answer" and click "Yes" so it can be beneficial to the community.