VMware Cloud Community
easuck
Contributor
Contributor
Jump to solution

Anyway to get current usage stat from vCenter via REST API?

I'm using REST API to develop a web-based private cloud management system that can monitor and have some automated functions like

"auto-create VM as user want if there are enough resources" and "auto-remove unused VM for a time (e.g. 1 month)".

There are anyway to get some stat from vCenter like CPU, RAM, Storage usage to use for "auto-create VM if there are enough resources" cause I get appliance health it's show as "Green" not the values.

Update:

I had use this REST API - query to get monitoring data but I don't know how to use these data values.

I thought the "16423596.0" was something like total memory in KB but I converted it to GB its not equal to actual memory on vCenter host.

Capture.JPG

My cloud environment contains 1 vCenter and 1 seperate ESXi as host.

ESXi spec:

Intel(R) Xeon(R) CPU E5620 @ 2.40GHz (8 Logical Processor)

4 GB Memory

402 GB Storage

Sorry for my bad english

Message was edited by: Chatchai Wongdetsakul

Reply
0 Kudos
1 Solution

Accepted Solutions
daphnissov
Immortal
Immortal
Jump to solution

You need to be using vROps for this which does have it available via REST. vCenter still doesn't not have a complete REST API implementation yet.

View solution in original post

Reply
0 Kudos
7 Replies
daphnissov
Immortal
Immortal
Jump to solution

You need to be using vROps for this which does have it available via REST. vCenter still doesn't not have a complete REST API implementation yet.

Reply
0 Kudos
easuck
Contributor
Contributor
Jump to solution

If I don't have vROps, can I use the REST API - query or there is another way to get the vCenter host spec?

Reply
0 Kudos
daphnissov
Immortal
Immortal
Jump to solution

Not at this time. You need vROps really badly if you're actually trying to write your own private cloud from scratch.

easuck
Contributor
Contributor
Jump to solution

Thanks for answer but I still wonder about other SDK like vSphere Automation SDK for Java - VMware {code} will required vROps same as REST?

or any advice that I needed to know to create those functions.

Reply
0 Kudos
daphnissov
Immortal
Immortal
Jump to solution

What I'm trying to say is that, at this time, performance counters aren't even ​available in the REST API. It doesn't matter what bindings you use, they simply aren't there yet. REST is still a WIP with only a fraction of all the stuff available there. The vast majority is still SOAP.

skv0011
Contributor
Contributor
Jump to solution

Hi,

Could you please let me know if this is now available through REST API (figured I will ask as its been couple of years since the last update on this question)?

 

Thanks,

Sampath

Reply
0 Kudos
mahdidahmani
Contributor
Contributor
Jump to solution

REST API is very limited, i highly recommend you to use the SDK

using Python and pyVmomi libraty 

documentation for all available methods and Properties are available on this link:

https://developer.vmware.com/apis/1192/vsphere

for the Performance Counter you can find the description in this link

https://www.virten.net/2020/12/vsphere-7-0-performance-counter-description/

Reply
0 Kudos