Sep 18 2018
10:06 PM
- last edited on
Apr 07 2022
05:29 PM
by
TechCommunityAP
Sep 18 2018
10:06 PM
- last edited on
Apr 07 2022
05:29 PM
by
TechCommunityAP
Able to retrieve Azure VM Host Metrics using Azure Management API call.
https://docs.microsoft.com/en-us/azure/virtual-machines/linux/metrics-vm-usage-rest
When trying to fetch performance counters using Azure Log Analytics API as per below reference link, it is generating below error.
{
"error": {
"message": "Valid authentication was not provided",
"code": "AuthorizationRequiredError",
"innererror": {
"code": "UnsupportedKeyError",
"message": "The given API Key is not valid for the request"
}
}
}
Can you please provide anyone how to obtain these by correcting above error?
DEMO_KEY : key generated after registering app under Azure AD App registrations and providing owner permissions for registered app to access Log Analytics services.
Sep 20 2018 09:24 AM
Hi,
I think you might have mixed the logs and metrics APIs, which are separate. Logs contain a lot of performance data, some of which also covered by Metrics, which might be confusing.
To query, for example, the top 3 highest-memory using computers you want to run this query over Log Analytics:
Perf | where TimeGenerated > ago(1h) | where ObjectName == \"Memory\" and CounterName == \"Used Memory MBytes\" | summarize average_used_memory=avg(CounterValue) by Computer | top 3 by average_used_memory
(note this specific counter name is reported for Linux machines only). To run this through the API, post the query in a JSON format (shown below) to "https://api.loganalytics.io/v1/workspaces/DEMO_WORKSPACE/query" (url for the demo workspace API) and add the 2 required headers, as shown below:
You can find the details here.
HTH,
Noa