vSphere: Filter custom fields like "tags"

Hello,
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?

Background:
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

Hi,
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

2 Likes

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.

@Carsten 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:

1 Like