Http monitoring not working

Hi,
I’m trying to configure an http check for some websites on external hosts, but it always answers “Name or service not know”

image

My configuration is:

object Host "mydomain.com" {
  check_command = "check_domain_expiration"

  // check_http
  vars.http_vhosts["http"] = {
    http_vhost = "my domain.com"
    http_uri = "/"
  }

  // check_domain_expiration
  vars.domain_check = name
}

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

  vars += config

  //assign where host.vars.http_vhosts
}

// Domain Expiration Check
apply Service "Domain Expiration" {
  check_command = "check_domain_expiration"
  assign where host.vars.domain_check
}

If I execute check_http via command-line it works fine:

check_http -H mydomain.com -u “/”
HTTP OK: HTTP/1.1 301 Moved Permanently - 352 bytes in 0.022 second response time |time=0.021921s;;;0.000000;10.000000 size=352B;;;0

check_domain_expiration works fine

Any help would be appreciated

OK, it’s working now. I just added “http_address = mydomain”

object Host "mydomain.com" {
  check_command = "check_domain_expiration"

  // check_http
  vars.http_vhosts["http"] = {
    http_address = "mydomain.com"
    http_vhost = "mydomain.com"
    http_uri = "/"
  }
  vars.http_vhosts["www"] = {
    http_address = "www.mydomain.com"
    http_vhost = "www.mydomain.com"
    http_uri = "/"
  }

  // check_domain_expiration
  vars.domain_check = name
}
1 Like