Get performance counters from VMWare vSphere using VIX? - com

I can use VMWare PowerCLI to get CPU usage with command line like "get-stat -entity $vm -realtime -maxsample $n -stat cpu.usage.average".
As far as I know PowerCLI uses VMWare VIX API to communicate with vSphere server.
But I can't find VIX API method which allows me to get such performance counter.
Am I wrong? Or should I use full VMWare SDK instead of VIX to get performance data? Thank you.

Related

How to Get CPU usage for each VM on ESXI host

I want to get CPU usage (cumulative) for each VM hosted on a VMware ESXI host.
I tried using Power CLI command 'Get-VMHost' but it only gives the overall CPU usage by ESXI host.
For CPU usage esxtop is a very powerful ESX command and you have to run it at the CLI. I haven't used the Power CLI so I'm unsure if it's available there but it is definitely available at the CLI which VMware tries to discourage you from using (see https://kb.vmware.com/s/article/2004746). Documentation for esxtop for the latest release of vSphere is at https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.monitoring.doc/GUID-D89E8267-C74A-496F-B58E-19672CAB5A53.html.
That document is a bit terse and in terms of getting CPU usage for each VM this old documentation for esxtop may guide you a bit better https://www.vmware.com/pdf/esx2_using_esxtop.pdf. In particular note the different nomenclature of ESXi (and ESX) for which the primary unit of address space and execution is the "world" rather than the "process". Thus you want to get the CPU usage for all "worlds" associated with each VM. Some VMs may have only a single "world" and some may have several and it is configurable. As for esxtop, it has been around forever and most likely it can still today provide the same functionality that it did over a decade ago with ESX 2.

How can i gather the following metrics from VMware vCenter vSphere REST api?

Could I gather the following metrics from VMware vCenter vSphere REST api?
Datastore Read/Write IOPS
Network Bandwith
Cluster Memory Usage
Cluster CPU
Usage
Or is this data only accessible through the Powershell CLI?
Thanks
Unfortunately, there's only a limited subset of metrics available via the REST API and almost all of them are only for the vCenter Appliance itself.
The stats are available from the vSphere Web Services API, particularly the PerformanceManager service.
You can also access that through numerous programing languages (vSphere Management SDK, pyvmomi, rbvmomi, govmomi, etc.), as well as PowerShell/PowerCLI.

Get few information of virtual machines using PowerCLI

I am using PowerCLI on RHEL to fetch information from VMs.
I have searched many websites, but I am not getting how to find this details like:
Established connections of VM,
Load Average,
Top Processes,
Process Counts..
It would be a grateful, if anybody knows how to get these details using PowerCLI...
note: I think there are cmdlets which work for windows powerCLi, but doesn't for RHEL.
Thank you
Invoke-VMScript is going to be the cmdlet you'll want to use to obtain that sort of information, however it is not yet functional in the PowerCLI Core fling.
Note: The PowerCLI Core fling isn't a supported VMware release and it also has a dependency on using the PowerShell Alpha release... where as PowerShell is on Beta and even RC builds.
The goal is certainly to make it functional on PowerShell 6.0, but it's not there yet.

Is there any way to restart ESX management network through python PyVmomi

I am trying to restart an ESX management network through Python Pyvmomi.
Even after Google search I did not find any relevant API to do so.
Please help me if there is any API which can restart/stop ESX management network which is managed by VCentre.
OK. Well the answer is no this is not possible using pyvmomi. If you are open to using an SSH lib you could log onto the ESX/i server directly and do the steps in the KB article.

ESX 5.5 VM deployment

Is it possible to deploy vm's using a csv or something similar? I want to automate the install of about 100 servers. The only option I have found is using powershell. I would really like some other options though. Thanks.
VCenter exposes an API, the documentation for which can be found here:
http://www.vmware.com/support/pubs/sdk_pubs.html
Armed with that API and a template, you should be able to do what you want to do in the language of your choice.
Templates can be customized with a CustomizationSpec directly from the VSphere client as well, which means you can deploy directly from the template in the client.
Other options: VMware's Orchestrator or Microsoft Orchestrator with the VMware plugin.
However, is there really any reason not to use Powershell? PowerCLI can do what you want to do and very easily. I've deployed thousands of servers with it.