I am looking at the GitHub repo and (https://github.com/Azure/azure-sdk-for-java) and I can't seem to find any example on how to obtain the metrics from Azure environment. Is it even supported by the SDK ?
Asked
Active
Viewed 540 times
2
-
What specific metrics are you looking for to get from Azure SDK for Java? Please be more specific. – juvchan Jan 27 '17 at 14:59
-
I am looking to get metrics related to VM and Storage Accounts for my subscription. I am mostly concerned with the usage metrics for Percentage CPU, Network In, Network Out, Disk Read Bytes, Disk Write Bytes for the VM. Similarly for the Storage I am concerned with the usage. – user1142317 Jan 27 '17 at 15:54
-
You might be better off enabling New Relic or Application Insights for those kind of metrics which is pretty easy in the Azure portal. – Derrick Jan 31 '17 at 05:14
1 Answers
3
You can refer to the sample code in the Azure SDK for Java GitHub code repo for example on how to get the Azure Storage Account Usage Metrics.
You can also get the test result of the sample code here.
Update 1:
You'll need to use the Azure Monitor REST API for retrieving the granular level metrics for Azure resources such as Virtual Machine or Storage Account.
List metrics for a resource in Azure Monitor REST API
E.g. For retrieving metrics for virtual machine, issue GET request with the below sample REST API.
GET https://management.azure.com/subscriptions/{subscription_id}/resourceGroups/{resource_group_name}/providers/Microsoft.Compute/virtualMachines/{virtual_machine_name}/providers/microsoft.insights/metrics?api-version=2016-09-01
At present, Azure SDK for Java does not have the package which supports the Azure Monitor REST API as above. You will need to use some REST client and custom code to manage the REST APIs calls for your usage.

juvchan
- 6,113
- 2
- 22
- 35
-
Thanks for the reply. But what I was looking for was much more granular data. For eg VM usage metrics on a per hour basis. Something on the lines of https://management.azure.com//subscriptions/xxxxxx/resourceGroups/vmturbo/providers/Microsoft.Compute/virtualMachines/WindowsVM/providers/microsoft.insights/metrics?api-version=2016-06-01&$filter= name.value eq 'Network In' and aggregationType eq 'Average' and startTime eq 2017-01-20 and endTime eq 2017-01-21 and timeGrain eq duration'PT1H' – user1142317 Jan 28 '17 at 05:44
-
-
-
If this is helpful to you and if you appreciate the effort of the answer, please mark as answer as it will be useful for other users as well. – juvchan Jan 28 '17 at 12:22
-
1