Filter Import source for host vars

Hello,

i have a host var named “check_x509_certificates”. If this set to false i dont like to import this host for my x509 service check.

I dont understand the modifiers that i could filter for a host var. I’ve read a old post that i have to “trim” it, but that does not make sense here.

So, could some give me a tip please how i could filter on the import.

Otherwise i maybe could do this later in the sync rule, but for me it would make sense to just not import it before the sync rule starts.

Thanks.

Hello!
I’m not really getting what you are trying to achive.

Are the hosts with the variable already active in the monitoring and you (don’t) want to apply a service to them?
In this case simply point the apply rule to all hosts where “host.vars.check_x509_certificates is true (or set)”

Or do the hosts exist in an import source, from which you create new services for them?
If so, create a new modifier in the import source that rejects the row ifthe variable is false

If neither is the case, please clear the situation up with some examples :slight_smile:

If you used the import source “Director Hosts”, as I described in my last post to your other question, then you should be able to read this variable in the x509 service import and discard the rows with check_x509_certificates = false. In the same way the rows without a matching host got discarded.

Use the preview in the “Director Hosts” import source to understand the data structure to get at the variable from the x509 service import.

An alternative would be the regex filters in my import but I should replace those with your idea, so my users can manage this variable on their hosts and don’t need me for this.