VMware vSphere

 View Only
  • 1.  Anyway to get current usage stat from vCenter via REST API?

    Posted Nov 13, 2018 08:26 AM

    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.

    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



  • 2.  RE: Anyway to get current usage stat from vCenter via REST API?
    Best Answer

    Posted Nov 13, 2018 01:29 PM

    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.



  • 3.  RE: Anyway to get current usage stat from vCenter via REST API?

    Posted Nov 14, 2018 04:32 AM

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



  • 4.  RE: Anyway to get current usage stat from vCenter via REST API?

    Posted Nov 14, 2018 01:54 PM

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



  • 5.  RE: Anyway to get current usage stat from vCenter via REST API?

    Posted Nov 15, 2018 02:50 PM

    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.



  • 6.  RE: Anyway to get current usage stat from vCenter via REST API?

    Posted Nov 15, 2018 02:54 PM

    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.



  • 7.  RE: Anyway to get current usage stat from vCenter via REST API?

    Posted Dec 29, 2020 06:14 PM

    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



  • 8.  RE: Anyway to get current usage stat from vCenter via REST API?

    Posted Jan 19, 2022 05:07 PM

    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/