func (a *Agent) agentHTTPCheck(server bool) *structs.ServiceCheck {
	// Resolve the http check address
	httpCheckAddr := a.config.normalizedAddrs.HTTP
	if *a.config.Consul.ChecksUseAdvertise {
		httpCheckAddr = a.config.AdvertiseAddrs.HTTP
	}
	check := structs.ServiceCheck{
		Name:      "Nomad Client HTTP Check",
		Type:      "http",
		Path:      "/v1/agent/servers",
		Protocol:  "http",
		Interval:  clientHttpCheckInterval,
		Timeout:   clientHttpCheckTimeout,
		PortLabel: httpCheckAddr,
	}
	// Switch to endpoint that doesn't require a leader for servers
	if server {
		check.Name = "Nomad Server HTTP Check"
		check.Path = "/v1/status/peers"
	}
	if !a.config.TLSConfig.EnableHTTP {
		// No HTTPS, return a plain http check
		return &check
	}
	if !a.consulSupportsTLSSkipVerify {
		a.logger.Printf("[WARN] agent: not registering Nomad HTTPS Health Check because it requires Consul>=0.7.2")
		return nil
	}
	if a.config.TLSConfig.VerifyHTTPSClient {
		a.logger.Printf("[WARN] agent: not registering Nomad HTTPS Health Check because verify_https_client enabled")
		return nil
	}

	// HTTPS enabled; skip verification
	check.Protocol = "https"
	check.TLSSkipVerify = true
	return &check
}
// agentHTTPCheck returns a health check for the agent's HTTP API if possible.
// If no HTTP health check can be supported nil is returned.
agentHTTPCheck returns a health check for the agent's HTTP API if possible.
If no HTTP health check can be supported nil is returned.
// agentHTTPCheck returns a health check for the agent ' s HTTP API if possible . // If no HTTP health check can be supported nil is returned .
func (a *Agent) agentHTTPCheck(server bool) *structs.ServiceCheck {
	httpCheckAddr := a.config.normalizedAddrs.HTTP
	if *a.config.Consul.ChecksUseAdvertise {
		httpCheckAddr = a.config.AdvertiseAddrs.HTTP
	}
	check := structs.ServiceCheck{
		Name:      "Nomad Client HTTP Check",
		Type:      "http",
		Path:      "/v1/agent/servers",
		Protocol:  "http",
		Interval:  clientHttpCheckInterval,
		Timeout:   clientHttpCheckTimeout,
		PortLabel: httpCheckAddr,
	}
	if server {
		check.Name = "Nomad Server HTTP Check"
		check.Path = "/v1/status/peers"
	}
	if !a.config.TLSConfig.EnableHTTP {
		return &check
	}
	if !a.consulSupportsTLSSkipVerify {
		a.logger.Printf("[WARN] agent: not registering Nomad HTTPS Health Check because it requires Consul>=0.7.2")
		return nil
	}
	if a.config.TLSConfig.VerifyHTTPSClient {
		a.logger.Printf("[WARN] agent: not registering Nomad HTTPS Health Check because verify_https_client enabled")
		return nil
	}
	check.Protocol = "https"
	check.TLSSkipVerify = true
	return &check
}
func ( a * Agent ) agentHTTPCheck ( server bool ) * structs . ServiceCheck { httpCheckAddr := a . config . normalizedAddrs . HTTP if * a . config . Consul . ChecksUseAdvertise { httpCheckAddr = a . config . AdvertiseAddrs . HTTP } check := structs . ServiceCheck { Name : " " , Type : " " , Path : " " , Protocol : " " , Interval : clientHttpCheckInterval , Timeout : clientHttpCheckTimeout , PortLabel : httpCheckAddr , } if server { check . Name = " " check . Path = " " } if ! a . config . TLSConfig . EnableHTTP { return & check } if ! a . consulSupportsTLSSkipVerify { a . logger . Printf ( " " ) return nil } if a . config . TLSConfig . VerifyHTTPSClient { a . logger . Printf ( " " ) return nil } check . Protocol = " " check . TLSSkipVerify = true return & check }
agentHTTPCheck returns a health check for the agent's HTTP API if possible.
agentHTTPCheck returns a health check for the agent ' s HTTP API if possible .
// Resolve the http check address // Switch to endpoint that doesn't require a leader for servers // No HTTPS, return a plain http check // HTTPS enabled; skip verification