Filter hosts or Service based on custom_vars

Hello to all,

I have a question about the standard filter function. I mean the “Search” function in the integrated Overview menu as Host or Service. The standard search feature filters the object by host name or display name and the same in the service overview.

Is there the possibility to add some search columns?

All my hosts has some custom_vars that define some attributes or the location (City, street) of the object.

is there the possibility to add this custom_vars to the default search function like the hostname or the displayname?

Thanks

For better explanation:

‘WE’ modify the code from basis module monitoring in this way:

public function getSearchColumns($search = null)
{
    if ($search !== null
        && (@inet_pton($search) !== false || preg_match('/^\d{1,3}\.\d{1,3}\./', $search))
    ) {
        return array('host', 'host_address', 'host_address6');
    } else {
        if ($this->connection->isIcinga2()) {

// return array(‘host’, ‘host_display_name’);
return array(‘host’, ‘host_display_name’,’_host_search_field_1’,’_host_search_field_2’);
} else {
return array(‘host’, ‘host_display_name’, ‘host_alias’);
}
}
}

the variables _host_search_field_1 and host_search_field_2 are an example for my custom_vars.

but it is not so nice to modify the source code.

Thanks

Does this change produce the result you want? If so, you could open an issue on the Icingaweb2 github, submit a PR, and then get some input on any changes that may need to happen, or at least get input on why this isn’t the case.

I’m mildly interested in this myself, having just trained a batch of users today on how to use the search filters without using the search bar :laughing: