Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to retrieve the vc.uuid from vmtools ? #734

Open
gits68 opened this issue Aug 11, 2024 · 2 comments
Open

Any way to retrieve the vc.uuid from vmtools ? #734

gits68 opened this issue Aug 11, 2024 · 2 comments

Comments

@gits68
Copy link

gits68 commented Aug 11, 2024

Is your feature request related to a problem? Please describe.

May help to autoconfigure zabbix client while using the "VMWare Guest" Template which identifies hosts using their vc.uuid instead of editing the configuration file on every hosts.

# grep ^HostnameItem= /etc/zabbix/zabbix_agent*.conf
HostnameItem=system.run[vmware-toolbox-cmd stat raw text session | awk '/vc.uuid/{print $NF}']

or
HostnameItem=system.run[vmware-toolbox-cmd stat raw json session | jq -r '."vc.uuid"'

Describe the solution you'd like

# vmware-toolbox-cmd stat raw text session
session = -14796381390335328
uptime = 338588675128
version = VMware ESX 7.0.3 build-23307199
provider =
uuid.bios = 42 20 6f a4 2a 8a 54 5b-74 7a 05 5f 1f 22 d0 ce

vc.uuid = 5020efdf-1593-a8ef-27fb-2852a1b10fc2
or
vc.uuid = 50 20 ef df 15 93 a8 ef 27 fb 28 52 a1 b1 0f c2

Describe alternatives you've considered

Fill guestInfo.vc.uuid the same way guestInfo.detailed.data if filled

Additional context

dmidecode doesn't help, only uuid.bios is returned

@johnwvmw
Copy link
Contributor

I have filed an enhancement bug to provide a means to obtain the vm instance id (vc.uuid) from within a running guest VM.

@gits68
Could you provide more details how the vc.uuid would be used in the zabbix agent config file and what benefits are to be gained over the default "system.hostname". A better idea how this woulc or could be used would help add weight to the enhancement request.

Thanks

@gits68
Copy link
Author

gits68 commented Aug 18, 2024

Hi,

it depends on the template used, "vmware" or "vmware fqdn", the former historically uses vc.uuid to identify hosts while the later uses the hostname.
The format used by zabix is 5020efdf-1593-a8ef-27fb-2852a1b10fc2, probably the one returned by the vmware api.

Usage examples

Case vmware template:
Hostname=5020efdf-1593-a8ef-27fb-2852a1b10fc2
Or vc.uuid if it would be accessible some way
#Hostname=
[vmware-toolbox-cmd stat raw text session | awk '/vc.uuid/{print $NF}']

Case vmware fqdn template:
Hostname=somename
Or
#Hostname=
HostnameItem=system.hostname

PS: Don't remember, but possibly returned the system.hostname by default if all commented
#Hostname=
#HostnameItem=

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants