Hi Stephen Wong •,
Welcome to Microsoft Q&A forum.
As I understand, you are unable to see monitor metrics data with Azure CLI commands for Azure Database for MySQL Flexible Server.
Could you please run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade.
Other pointers to check are as below:
- Microsoft.Insights resource provider isn't registered for your subscription
Exploring metrics requires Microsoft.Insights resource provider registered in your subscription. In many cases, it's registered automatically (that is, after you configure an alert rule, customize diagnostic settings for any resource, or configure an autoscale rule). If the Microsoft.Insights resource provider isn't registered, you must manually register it by following steps described in Azure resource providers and types.
Solution: Open Subscriptions, Resource providers tab, and verify that Microsoft.Insights is registered for your subscription.
- You don't have sufficient access rights to your resource
In Azure, Azure role-based access control (Azure RBAC) controls access to metrics. You must be a member of monitoring reader, monitoring contributor, or contributor to explore metrics for any resource.
Solution: Ensure that you have sufficient permissions for the resource from which you're exploring metrics.
- Your resource didn't emit metrics during the selected time range
Some resources don’t constantly emit their metrics. For example, Azure doesn't collect metrics for stopped virtual machines. Other resources might emit their metrics only when some condition occurs. For example, a metric showing processing time of a transaction requires at least one transaction. If there were no transactions in the selected time range, the chart is naturally empty. Additionally, while most of the metrics in Azure are collected every minute, there are some that are collected less frequently. See the metric documentation to get more details about the metric that you're trying to explore.
Solution: Change the time of the chart to a wider range. You may start from "Last 30 days" using a larger time granularity (or relying on the "Automatic time granularity" option).
- You picked a time range greater than 30 days
Most metrics in Azure are stored for 93 days. However, you can only query for no more than 30 days worth of data on any single chart. This limitation doesn't apply to log-based metrics.
Solution: If you see a blank chart or your chart only displays part of metric data, verify that the difference between start- and end- dates in the time picker doesn't exceed the 30-day interval. Once you select a 30 day interval, you can pan the chart to view the full retention window.
Please refer to this Microsoft official documentation for more details on how to troubleshoot metric charts:
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-troubleshoot
Hope this helps.
Let us know your findings.
Thanks