VMware Cloud Community
dingding
Enthusiast
Enthusiast

How to get the ESX run the VM currently

i have a cluster with some ESX in it. since VM may be float from ESX to ESX? is there any script that i can get the current host whom run/host the VM? or is there any config file record this?

---- Idleness is not doing nothing. Idleness is being free to do anything.
Reply
0 Kudos
10 Replies
Gerrit_Lehr
Commander
Commander

If you don't want to use the information provided by virtual center, there several ways to get this infomration scriptes e.g. using vmware-cmd.

This one might help: http://communities.vmware.com/thread/47823

Kind Regards,

Gerrit Lehr

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".

Kind regards, Gerrit Lehr If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
dingding
Enthusiast
Enthusiast

thanks for reply. i have vCenter, so maybe some easier script to get what i want. i use vcbVmName to connect to vCenter, i get all VMs, but no ESX host information

---- Idleness is not doing nothing. Idleness is being free to do anything.
Reply
0 Kudos
AndreTheGiant
Immortal
Immortal

Use PowerShell or other scripting tools.

There are a lot of documentation and examples.

Andre

**if you found this or any other answer useful please consider allocating points for helpful or correct answers

Andrew | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
Reply
0 Kudos
depping
Leadership
Leadership

With powershell you could do something like:

Get-Cluster <cluster-name> | Get-VmHost | Get-Vm

Duncan

VMware Communities User Moderator | VCP | VCDX

-


Blogging:

Twitter:

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
dingding
Enthusiast
Enthusiast

powershell seems like a windows tool. is there ony script tool in linux(COS)?

---- Idleness is not doing nothing. Idleness is being free to do anything.
Reply
0 Kudos
depping
Leadership
Leadership

it is a windows tool indeed. what do you need? a Linux tool or do you want to use the VMware service console?

you could use the RCLI to access every host and do a list. Or even perl.

Duncan

VMware Communities User Moderator | VCP | VCDX

-


Blogging:

Twitter:

If you find this information useful, please award points for "correct" or "helpful".

Reply
0 Kudos
AndreTheGiant
Immortal
Immortal

powershell seems like a windows tool. is there ony script tool in linux(COS)?

PowerShell is a scripting language. Ok is for Windows. You can use Perl or Python Smiley Wink

With the correct language extension (using VMware API) you can have specific command for manage VM, ESX, VC, ...

Sometimes this command are more powerful than the "native" COS command.

Andre

**if you found this or any other answer useful please consider allocating points for helpful or correct answers

Andrew | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
Reply
0 Kudos
dingding
Enthusiast
Enthusiast

as you mentioned, can I use the perl or python method in COS? What package should be installed at first?

---- Idleness is not doing nothing. Idleness is being free to do anything.
Reply
0 Kudos
dingding
Enthusiast
Enthusiast

OK, what I need is writing some script in COS. Say I have a cluster with 4 ESX. I want to deploy backup software, but my backup windows is small.

If I using VCB proxy method, since the backup software can only do one backup at a time, the time can’t fit the window. I want to install the backup client in each ESX COS, so I can do simultaneous backup. Before backup begin, I want to suspend the VM to keep the file consistency. But the VM, you know, can be vmotion to any ESX.

I try vmware-cmd, but this command need a parameter that where the VM reside. This is my requirement. So RCLI is not a option. Yes I can use vmware-cmd to qurey every host, but Is there any method more convenient?

---- Idleness is not doing nothing. Idleness is being free to do anything.
Reply
0 Kudos
AndreTheGiant
Immortal
Immortal

as you mentioned, can I use the perl or python method in COS? What package should be installed at first?

You do not need to write this script and run from COS. Can run also from an external system (or also a VM).

For information on the Perl API:

http://www.vmware.com/support/developer/viperltoolkit/

Andre

**if you found this or any other answer useful please consider allocating points for helpful or correct answers

Andrew | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
Reply
0 Kudos