Reputation: 1124
I am trying to fetch metrics from Azure using Azure Insights REST API. I followed the steps given at this blog to get the auth token. When I try to fetch the metrics, I get the error "InvalidFilterValueParameterArgument Null Parameter name: $filter". I searched for the documentation on what the filter parameters but could not find one.
The url I am trying to fetch the metric from is:
https://management.azure.com/subscriptions/<"subscriptionid">/resourceGroups/<"resourcegroupname">/providers/Microsoft.ClassicCompute/virtualMachines/<"vm name">/metrics?api-version=2014-04-01
Can anyone point me in the right direction?
Upvotes: 0
Views: 201
Reputation: 1124
On further reading and playing around the attached demo app in the blog, https://blogs.msdn.microsoft.com/cloud_solution_architect/2016/02/23/retrieving-resource-metrics-via-the-azure-insights-api/, I found the answer (don't know how I missed it).
The url should be,
https://management.azure.com/subscriptions/<"subscriptionid">/resourceGroups/<"resourcegroupname">/providers/Microsoft.ClassicCompute/virtualMachines/{vm name}/metrics?api-version=2014-04-01&$filter=%28name.value%20eq%20%27AverageResponseTime%27%20or%20name.value%20eq%20%27Requests%27%29%20and%20timeGrain%20eq%20duration%27PT1M%27%20and%20startTime%20eq%202016-02-18T20%3A26%3A00.0000000Z%20and%20endTime%20eq%202016-02-18T21%3A26%3A00.0000000Z
Without encoding, the actual $filter parameter string would be,
"(name.value eq 'AverageResponseTime' or name.value eq 'Requests') and timeGrain eq duration'PT5M' and startTime eq 2016-02-18T20T20:26:00.0000000Z and endTime eq 2016-02-18T20T21:26:00.0000000Z"
.
We have to get the metricdefintions first to know what filters apply for the given resource.
Upvotes: 1