Host variable arrays and service assignments

Hello,

we define variables as arrays on the hosts in order to assign a service with different parameters.

For example, we monitor different TCP ports and their SSL certificates on the same host.
The same principle applies to different services on all hosts.

Host Object:

object Host "foobar.local" {

        vars.sslport["1311"] = {
                description = "Dell OpenManage Server Administrator"
                ssl_cert_port = "1311"
                # self-signed
                ssl_cert_selfsigned = true
                ssl_cert_ignore_ocsp = true
                # no expiry warning
                ssl_cert_ignore_expiration = true
        }

        vars.sslport["993"] = {
                description = "dovecot - imaps"
                ssl_cert_port = "993"
                # letsencrypt certificate
                ssl_cert_warn = "6"
                ssl_cert_critical = "3"
        }
}

Service Objects:

apply Service "TCP PORT" for (ssl_port_name => config in host.vars.sslport) {
        import "generic-service-5m"
 
        check_command = "tcp"
        display_name = "TCP PORT " + ssl_port_name
        name = "tcp port " + ssl_port_name

        vars += config

        vars.tcp_port = config.ssl_cert_port

        assign where host.vars.sslport
}

apply Service "SSL CERTIFICATE VALIDATION" for (ssl_port_name => config in host.vars.sslport) {
        import "generic-service-60m"
        
        check_command = "ssl_cert"
        display_name = "SSL CERTIFICATE ON PORT " + ssl_port_name
        name = "ssl certificate port " + ssl_port_name

        vars.ssl_cert_warn = "90"
        vars.ssl_cert_critical = "7"

        vars += config

        assign where host.vars.sslport
}

Is it possible to recreate this workflow on the director?!