Http_check monitor virtual hosts

I have several websites that I want to check. Normally they are virtual hosts on nignx servers. So in server1 I can have 2 virtualhosts, in server2 3 virtualhosts, in server3 1 virtualhosts, and so on. I also want to check ssl certificates. What would be the best way to do this?

So far I have done this.

Service definition:

apply Service "HTTP" {
  import "generic-service"
  check_command = "http"
  command_endpoint = "master.foo.bar"

  assign where host.vars.vhosts
}

On a host definition:

object Host "host1.foo.bar"  {
    import "generic-host"

    vars.vhosts["host1.foo.bar"] = {
      http_ssl = true
    }
    vars.vhosts["site1.foo.barl"] = {
      http_ssl = true
    }
}

So in Icingaweb2 I can monitor host1.foo.bar, but not site1.foo.bar.

Does this make sense? Am I on the right track? The ssl part would come later.

Thanks a lot.

Take a look at the docs for “Apply for” and “Apply for with custom vars override”:
https://icinga.com/docs/icinga2/latest/doc/03-monitoring-basics/#using-apply-for-rules

This should do what you are looking for :slight_smile:

1 Like

yes, thanks a lot :slight_smile: