Check_http certificates for more websites on one server

Hi guys,

I have a load balancer hosting more websites/ certificates.
Is check_http able to check more website certificates on one server?

apply Service for (http => config in host.vars.http) {
    import "generic-service"
    check_command = "http"
    vars += config
	vars.sla = host.vars.sla
}

object Host ...

...   
    vars.http["domain1"] = {
        vars.http_ssl = true
        vars.http_vhost = "domain1"
        vars.http_certificate = "30,20"
    }

    vars.http["domain2"] = {
        vars.http_ssl = true
        vars.http_vhost = "domain2"
        vars.http_certificate = "30,20"
    }

This config does not check the certificate :frowning:

Hello

your definitions should be
vars.http_vhosts["domain1"]

to see the example take a look at the hosts.conf template file that comes in the default installation of Icinga2.

/etc/icinga2/conf.d/hosts.conf

Regards

1 Like

I always get the same certificate for different domains, with this config. The certificates are all in the same directory.
Is it possible to match the domain to the right certificate?

apply Service for (http_vhost => config in host.vars.http_vhosts) {
    import "generic-service"

    check_command = "http"

    vars += config
    display_name = "Certificate"

    vars.sla = host.vars.sla
}

object Host     "Horst" {
    import      "unix-ext"
   ...

    vars.http_vhosts["www.foobar1.com"] = {
        http_certificate =  "30,20"
      }
    vars.http_vhosts["www.foobar2.com"] = {
        http_certificate =  "30,20"
      }
}