1

I am using Azure Java SDK. Is there a way to find out a VM's usage metrics using the SDK like CPU and Memory?

I have already tried

ComputeUsages computeUsages = this.azure.computeUsages();
        PagedList<ComputeUsage> listByRegion = computeUsages.listByRegion(Region.US_EAST);
        for(ComputeUsage cmp : listByRegion) {
            System.out.println("Compute usage " + cmp.name().localizedValue() + " == " + cmp.currentValue());
        }

But this gets me the metric information for the region as a whole. Is there a way to get metrics on a VM basis ?

user1142317
  • 533
  • 1
  • 8
  • 20

1 Answers1

1

Short answer: not yet.

Long answer: Azure Java SDK only covers management of VMs.

For finding out about metrics, you'll need to use Azure Monitor (formerly known as Azure Insights, not to be confused with App Insights). Unfortunately, this is not (yet) part of the Java SDK.

According to this issue, this is on the roadmap, though: https://github.com/Azure/azure-sdk-for-java/issues/663

So, while you'll be able to grab these metrics via plain REST-API today, it is not yet covered by Azure SDK for Java.

delMar
  • 26
  • 1
  • 2
  • @MohamedUvaisM as far as I could see, there is a new directory called "azure-mgmt-monitor" on https://github.com/Azure/azure-sdk-for-java . So, at least it seems as if it's in the works. I didn't verify the functionality, though. – delMar Apr 12 '17 at 08:51
  • @delMar Ya i saw it, but that is planned for azure-1.0.0.beta6 version, but the current version is azure-1.0.0.beta5 which doesnt have the API for azure monitor. – Mohamed Uvais M Apr 12 '17 at 10:45