Monitoring a second Windows client, but the first one is also monitored. How to ignore the first client -- assign where == ".." ignored(?)

This forum was archived to /woltlab and is now in read-only mode.
  • After successfuly adding one Windows client, I want to add a second one. I edited my conf.d/win-hosts.conf and addd a second object Host:

    It works and I see both Windows clients, but now I don't want to monitor the number of files in the first Windows client DOMAIN-NAME1 anymore.

    I tried and added assign where == "DOMAIN-NAME2"

    1. apply Service "check filecount" {
    2. import "generic-service"
    3. check_command = "files-windows"
    4. command_endpoint = host.vars.remote_client
    5. vars.files_windows_args = "-unit count -path 'C:\\Program Files\\ICINGA2\\sbin' -c g45"
    6. assign where host.vars.os == "Windows"
    7. assign where == "DOMAIN-NAME2"
    8. /*host_name = "DOMAIN-NAME2"*/
    9. }

    , so that only the second Windows client is monitored, but it seems not to do anything and still both DOMAIN-NAME1 and DOMAIN-NAME2 are monitored.

    How to solve?

  • You assign the Service to all Clients which have the variable value "Windows".

    What happens when you are deleting this line:

    1. assign where host.vars.os == "Windows"
  • I would keep the general assign where on vars.os, that's really a common pattern. Instead you should define a special flag which disables the service for specific hosts.

    You could also use a boolean flag for just host.vars.disable_filecount, but I prefer to use a generic exclude list for multiple apply rules using the "in" operator for string in array checks. That way you'll just render the exclude list for the hosts (you can hide them in templates too!) and you don't care about specific host name patterns anymore.