Consul
Health check configuration reference
This topic provides configuration reference information for health checks. For information about the different kinds of health checks and guidance on defining them, refer to [Define Health Checks].
Introduction
Health checks perform several safety functions, such as allowing a web balancer to gracefully remove failing nodes and allowing a database to replace a failed secondary. You can configure health checks to monitor the health of the entire node. Refer to Define Health Checks for information about how to define the different types of health checks available in Consul.
Check block
Specify health check options in the check block. To register two or more heath checks in the same configuration, use the checks block. The following table describes the configuration options contained in the check block.
| Parameter | Description | Check types | 
|---|---|---|
| name | Required string value that specifies the name of the check. Default is service:<service-id>. If multiple service checks are registered, the autogenerated default is appended with colon and incrementing number starting with1. | |
| id | A unique string value that specifies an ID for the check. Default to the namevalue. Ifnamevalues conflict, specify a unique ID to avoid overwriting existing checks with same ID on the same node. Consul auto-generates an ID if the check is defined in a service definition file. | |
| notes | String value that provides a human-readable description of the check. The contents are not visible to Consul. | |
| interval | Required string value that specifies how frequently to run the check. The intervalparameter is required for supported check types. The value is parsed by the golang time package formatting specification. | |
| timeout | String value that specifies how long unsuccessful requests take to end with a timeout. The timeoutis optional for the supported check types and has the following defaults:30s10s10s10s10s10s | |
| status | Optional string value  that specifies the initial status of the health check. You can specify the following values: critical(default)warningpassing | |
| deregister_critical_service_after | String value that specifies how long a service and its associated checks are allowed to be in a criticalstate. Consul deregisters services if they arecriticalfor the specified amount of time. The value is parsed by the golang time package formatting specification | |
| success_before_passing | Integer value that specifies how many consecutive times the check must pass before Consul marks the service or node as passing. Default is0. | |
| failures_before_warning | Integer value that specifies how many consecutive times the check must fail before Consul marks the service or node as warning. The value cannot be more thanfailures_before_critical. Defaults to the value specified forfailures_before_critical. | |
| failures_before_critical | Integer value that specifies how many consecutive times the check must fail before Consul marks the service or node as critical. Default is0. | |
| args | Specifies a list of arguments strings to pass to the command line. The list of values includes the path to a script file or external application to invoke and any additional parameters for running the script or application. | |
| docker_container_id | Specifies the Docker container ID in which to run an external health check application. Specify the external application with the argsparameter. | |
| shell | String value that specifies the type of command line shell to use for running the health check application. Specify the external application with the argsparameter. | |
| grpc | String value that specifies the gRPC endpoint, including port number, to send requests to. Append the endpoint with :/and a service identifier to check a specific service. The endpoint must support the gRPC health checking protocol. | |
| grpc_use_tls | Boolean value that enables TLS for gRPC checks when set to true. | |
| h2ping | String value that specifies the HTTP2 endpoint, including port number, to send HTTP2 requests to. | |
| h2ping_use_tls | Boolean value that enables TLS for H2ping checks when set to true. | |
| http | String value that specifies an HTTP endpoint to send requests to. | |
| tls_server_name | String value that specifies the server name used to verify the hostname on the returned certificates unless tls_skip_verifyis given. Also included in the client's handshake to support SNI. It is recommended that this field be left unspecified. The TLS client will deduce the server name for SNI from the check address unless it's an IP (RFC 6066, Section 3). There are two common circumstances where supplying atls_server_namecan be beneficial:tls_server_namecan be specified for SNI. Note: settingtls_server_namewill also override the hostname used to verify the certificate presented by the server being checked.tls_server_namewill also override the hostname used for SNI. | |
| tls_skip_verify | Boolean value that determines if the check verifies the chain and hostname of the certificate that the server presents. Set to trueto disable verification. We recommend setting tofalsefor production use. Default isfalse. | |
| method | String value that specifies the request method to send during HTTP checks. Default is GET. | |
| header | Object that specifies header fields to send in HTTP check requests. Each header specified in headerobject contains a list of string values. | |
| body | String value that contains JSON attributes to send in HTTP check requests. You must escape the quotation marks around the keys and values for each attribute. | |
| disable_redirects | Boolean value that prevents HTTP checks from following redirects if set to true. Default isfalse. | |
| os_service | String value that specifies the name of the name of a service to check during an OSService check. | |
| service_id | String value that specifies the ID of a service instance to associate with an OSService check. That service instance must be on the same node as the check. If not specified, the check verifies the health of the node. | |
| tcp | String value that specifies an IP address or host and port number for the check establish a TCP connection with. | |
| tcp_use_tls | Boolean value that enables TLS for TCP checks when set to true. | |
| udp | String value that specifies an IP address or host and port number for the check to send UDP datagrams to. | |
| ttl | String value that specifies how long to wait for an update from an external process during a TTL check. | |
| alias_service | String value that specifies a service or node that the service associated with the health check aliases. | 
Checks block
You can define multiple health checks in a single checks block. The checks block is an array of objects that contain the configuration options described in the check block configuration reference.