stony007_de
Enthusiast
Enthusiast

how to get custom values from vCenter

Jump to solution

hi guys

I need an idea!

For my monitoring, i have to get some custom information about the vCenter environment, but this info's are not include in VC by default.

So my client is an linux server with installed vSphereCLI and the server an W2k8 with installed vCenter 4.1.

My idea was to set an custom attribute on the vCenter Server and fill it with my technical information.

Is there an option to poll this custom value from vCenter, with the CLI from the linux server?

greeds

stony007_de

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager

np.

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

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware VCP3,4

VMware VCAP4-DCA

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

View solution in original post

0 Kudos
7 Replies
lamw
Community Manager
Community Manager

Yes, you can query for this custom attribute which is defined in your vCenter.

Take a look at these examples which utilizes the vSphere SDK for Perl which is part of the [vCLI|http://www.vmware.com/support/developer/vcli/ installation. You can also use VMware vMA which is a CentOS based virtual appliance which has the vCLI installed

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware VCP3,4

VMware VCAP4-DCA

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

0 Kudos
stony007_de
Enthusiast
Enthusiast

hmm..

that works, but it is not "the solution".

i forget, the custom argument can only defined for all hosts or all vms, not for an separate vm.

So i have to find an other way!

Maybe custom fields in the vCenter Database? I have to take a look around..

thank you....

0 Kudos
lamw
Community Manager
Community Manager

Not sure I understand you exactly ... you mentioned custom fields/values, which you can utilize the script that was provided in the previous reply to do what you're asking for. Custom fields are generated at either host or vm level, you don't need to set the fields for all VMs, you can set it for the ones you care about and have the script check if value is either populated or NULL...this is pretty trivial. If you must set specific custom values for specific VMs, I recommend you take a look at updating the VM annotation field, this property is actually part of the VM's configuration and follows the VM and does not require vCenter. Here is a script that demonstrates using the VM annotation field:

In the future, I recommend you clearly state what you're trying to accomplish so that others can better assist and understand your use case.

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware VCP3,4

VMware VCAP4-DCA

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

0 Kudos
stony007_de
Enthusiast
Enthusiast

of course!! that's it!!!

brilliant!

i use the Annotation for the vm!

thank you!!

p.s.

next time i try to clearly describe what i want to do... Smiley Wink

0 Kudos
lamw
Community Manager
Community Manager

np.

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

=========================================================================

William Lam

VMware vExpert 2009,2010

VMware VCP3,4

VMware VCAP4-DCA

VMware scripts and resources at:

Twitter: @lamw

Getting Started with the vMA (tips/tricks)

Getting Started with the vSphere SDK for Perl

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

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

View solution in original post

0 Kudos
cdcisco
Contributor
Contributor

Hi,

Sorry to dig up an old thread, but you said "Here is a script that demonstrates using the VM annotation field:"

But there's no script?

I am trying to find a script (preferrably perl) that will let me pull the annotation fields for a given vm name.

0 Kudos
lamw
Community Manager
Community Manager

Looks like threads created prior the upgrade of the forum software caused the links to be removed.

The script is here http://communities.vmware.com/docs/DOC-10779 and you can find others at the vGhetto Scripting Repository - http://communities.vmware.com/docs/DOC-9852

0 Kudos