vSphere: Filter custom fields like "tags"

we want to filter some hosts with the vSphere “Tags” (we use the vSphere-Module for director).
We can’t see them in the preview - is it a restriction of vsphere-api or the director module?

The sync always overwrites the hostgroup we’ve modified before the last sync.
We’ve different hostgroups for different usages.
Our idea is to split the import into several sync-jobs based on the vSphere-Tags.

Thank you & regards!

Better use the vspheredb module now gor imports. Thinknthe vsphere module doesnt get any love anymore.

True, with the recent release of vspheredb 1.1.0 also the Director import source has been added. icingaweb2-module-vsphere is subject to deprecation.

1 Like

thanks for your answer. We’ve now changed to vspheredb.
How can we get the vSphere “Tags”? There are no fields in “vspheredb”.

Tomorrow iam at my customer with vspheredb again. Then i can rake a look for you


Just took a look and the importer is only providing a few fields :frowning:
There si an open issue Make custom attributes for automation available #88 for that already.

1 Like

But you can easy add some other usefull fields from the db to the director import source.

Just edit the file vspheredb/library/Vspheredb/ProvidedHook/Director/ImportSource.php
and add the fields from the virtual_machine table you need/want

    protected $vmColumns = [
        'object_name'       => 'o.object_name',
        'guest_host_name'   => 'vm.guest_host_name',
        'guest_ip_address'  => 'vm.guest_ip_address',
        'hardware_numcpu'   => 'vm.hardware_numcpu',
        'hardware_memorymb' => 'vm.hardware_memorymb',
        'template'          => 'vm.template',
        'guest_full_name'   => 'vm.guest_full_name',

I added template, guest_host_name and guest_full_name.

1 Like

@anon66228339 Thanks, we tried it with custom attributes instead of tags - like proposed in the issue. Unfortunately also these custom attributes are not visible in the importer.

Any ideas?

The custom fields are at the moment developed into the module. There is a branch for that lab/customfields, but i would not recommend it to use in production.
Think this will come with one of the next versions, just be patience with @tgelf :slight_smile:


Hello Icinga World,

maybe someone can help?

I’ve seen the topic is already implemented as told here on 29 Apr 2020.

How could I make it available? Which version of whatever module do I need in my Icinga2 / Icingaweb2 (with director) test environment?
Would it be enough to get the latest vspheredb version?

… and if all requirements were met successfully, how could I expose a vcenter custom attribute to automation? Would it e.g. be available inside virtualization module previewing a host?

Any hints are very welcome! Greetings to all