Not able to exclude Applicationpools for Invoke-IcingaCheckIISAppPoolHealth

Hi there,

we are monitoring severel Windows systems. Some of them have disabled Applicationpools. So we setup a Service Apply Rule for Invoke-IcingaCheckIISAppPoolHealth with ExcludeAppPools = $host.vars.ExcludeAppPools$ to be able to set this host by host. I’v tried this with Data type String and also with Array.
So I’m able to exclude a single Apppool or a bunch of Apppools matching wildcard like pool*.
Now I have some Servers with multible, totaly diffrend named pools to exclude.
This is my Test with Array variable:
zones.d/director-global/service_apply.conf

apply Service "Windows-AppPoolTest" {
    import "generic-Windows-Service"

    check_command = "Invoke-IcingaCheckIISAppPoolHealth"
    assign where host.vars.IsIISServer || "IIS" in host.vars.ServerRole
    vars.IcingaCheckDiskHealth_Int32_Verbosity = "1"
    vars.IcingaCheckIISAppPoolHealth_Array_ExcludeAppPools = [ "$host.vars.IISExcludeAppPools$" ]
    vars.IcingaCheckIISAppPoolHealth_Int32_Verbosity = "3"
    vars.IcingaCheckIISAppPoolHealth_String_OverrideNoWorker = "Ok"
    vars.IcingaCheckIISHealth_Int32_Verbosity = "3"

    import DirectorOverrideTemplate
}

this one with string:
zones.d/director-global/service_apply.conf

apply Service "Windows-AppPool" {
    import "generic-Windows-Service"

    check_command = "Invoke-IcingaCheckIISAppPoolHealth"
    assign where host.vars.IsIISServer || "IIS" in host.vars.ServerRole
    vars.IcingaCheckDiskHealth_Int32_Verbosity = "1"
    vars.IcingaCheckIISAppPoolHealth_Array_ExcludeAppPools = [ "$host.vars.ExcludeAppPools$" ]
    vars.IcingaCheckIISAppPoolHealth_Int32_Verbosity = "3"
    vars.IcingaCheckIISAppPoolHealth_String_OverrideNoWorker = "Ok"
    vars.IcingaCheckIISHealth_Int32_Verbosity = "3"

    import DirectorOverrideTemplate
}

Excludig them in the Service Apply Rule works:
zones.d/director-global/service_apply.conf

/* --- This object has been disabled ---
apply Service "Windows-AppPoolHealthBackup" {
    import "generic-Windows-Service"

    check_command = "Invoke-IcingaCheckIISAppPoolHealth"
    assign where host.vars.IsIISServer || "IIS" in host.vars.ServerRole
    vars.IcingaCheckDiskHealth_Int32_Verbosity = "1"
    vars.IcingaCheckIISAppPoolHealth_Array_ExcludeAppPools = [ "CrmDeploymentServiceAppPool", "CRMAppPool" ]
    vars.IcingaCheckIISAppPoolHealth_Int32_Verbosity = "3"
    vars.IcingaCheckIISAppPoolHealth_String_OverrideNoWorker = "Ok"
    vars.IcingaCheckIISHealth_Int32_Verbosity = "3"

    import DirectorOverrideTemplate
}

*/

Has anyone a clue how to “fix” this?

Icinga Web 2 2.13.0
Git Commit 67b6c019781f9c33f645d823b489910e09d2f3fe
PHP Version 8.3.6
MODULE VERSION
icingadb 1.4.0
businessprocess 2.6.0
cube 1.3.2
director 1.11.8
doc 2.13.0
feeds 0.2.0
graphite 1.2.2
incubator 0.23.0
nagvis 1.2.1
notifications 0.2.0
pdfexport 0.10.2
perfdatagraphs 0.1.2
perfdatagraphsgraphite 0.1.2
reporting 0.10.0
statusmap 0.0.0
toplevelview 0.3.3

icinga2 - The Icinga 2 network monitoring daemon (version: r2.16.0-1)

thanks in advance
Joerg

Hi Joerg,

instead of creating a new variable at host level and assigning its value on service level simply add the IcingaCheckIISAppPoolHealth_Array_ExcludeAppPools variable to your host template.

Then you have the correct variable and format (array) the check uses at your hosts and you can manage the to-be-excluded pools at the hosts.

If you want to keep using the ExcludeAppPools variable, you need to change the assignment to the IcingaCheckIISAppPoolHealth_Array_ExcludeAppPools like so

vars.IcingaCheckIISAppPoolHealth_Array_ExcludeAppPools = “$host.vars.ExcludeAppPools$”

and ExcludeAppPools needs to be of type Array

Hi log1c,
thank you very much. I wasn’t aware, that i can use Command-Variables within Hosts. Adding the variable ho my Host-Template is the easiest and most elegant way. This fixed my Problem.