Health HTTP Endpoint
The /health
endpoints query health-related information. They are provided
separately from the /catalog
endpoints since users may prefer not to use the
optional health checking mechanisms. Additionally, some of the query results
from the health endpoints are filtered while the catalog endpoints provide the
raw entries.
To modify health check registration or information,
use the /agent/check
endpoints.
List Checks for Node
This endpoint returns the checks specific to the node provided on the path.
The HTTP response includes the X-Consul-Results-Filtered-By-ACLs: true
header
if the response array excludes results due to ACL policy configuration.
Refer to the HTTP API documentation for more information.
Method | Path | Produces |
---|---|---|
GET | /health/node/:node | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
YES | all | none | node:read,service:read |
Path Parameters
node
(string: <required>)
- Specifies the name or ID of the node to query.
Query Parameters
dc
(string: "")
- Specifies the datacenter to query. This will default to the datacenter of the agent being queried.filter
(string: "")
- Specifies the expression used to filter the queries results prior to returning the data.ns
(string: "")
Enterprise - Specifies the namespace of the checks you lookup. You can also specify the namespace through other methods.
Sample Request
Sample Response
Filtering
The filter will be executed against each health check in the results list with the following selectors and filter operations being supported:
Selector | Supported Operations |
---|---|
CheckID | Equal, Not Equal, In, Not In, Matches, Not Matches |
Name | Equal, Not Equal, In, Not In, Matches, Not Matches |
Node | Equal, Not Equal, In, Not In, Matches, Not Matches |
Notes | Equal, Not Equal, In, Not In, Matches, Not Matches |
Output | Equal, Not Equal, In, Not In, Matches, Not Matches |
ServiceID | Equal, Not Equal, In, Not In, Matches, Not Matches |
ServiceName | Equal, Not Equal, In, Not In, Matches, Not Matches |
ServiceTags | In, Not In, Is Empty, Is Not Empty |
Status | Equal, Not Equal, In, Not In, Matches, Not Matches |
List Checks for Service
This endpoint returns the checks associated with the service provided on the path.
The HTTP response includes the X-Consul-Results-Filtered-By-ACLs: true
header
if the response array excludes results due to ACL policy configuration.
Refer to the HTTP API documentation for more information.
Method | Path | Produces |
---|---|---|
GET | /health/checks/:service | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
YES | all | none | node:read,service:read |
Path Parameters
service
(string: <required>)
- Specifies the service to list checks for.
Query Parameters
dc
(string: "")
- Specifies the datacenter to query. This will default to the datacenter of the agent being queried.near
(string: "")
- Specifies a node name to sort the node list in ascending order based on the estimated round trip time from that node. Passing?near=_agent
uses the agent's node for the sort. This is specified as part of the URL as a query parameter.node-meta
(string: "")
- Specifies a desired node metadata key/value pair of the formkey:value
. This parameter can be specified multiple times, and filters the results to nodes with the specified key/value pairs. This is specified as part of the URL as a query parameter.filter
(string: "")
- Specifies the expression used to filter the queries results prior to returning the data.ns
(string: "")
Enterprise - Specifies the namespace of the service. You can also specify the namespace through other methods.
Sample Request
Sample Response
Filtering
The filter will be executed against each health check in the results list with the following selectors and filter operations being supported:
Selector | Supported Operations |
---|---|
CheckID | Equal, Not Equal, In, Not In, Matches, Not Matches |
Name | Equal, Not Equal, In, Not In, Matches, Not Matches |
Node | Equal, Not Equal, In, Not In, Matches, Not Matches |
Notes | Equal, Not Equal, In, Not In, Matches, Not Matches |
Output | Equal, Not Equal, In, Not In, Matches, Not Matches |
ServiceID | Equal, Not Equal, In, Not In, Matches, Not Matches |
ServiceName | Equal, Not Equal, In, Not In, Matches, Not Matches |
ServiceTags | In, Not In, Is Empty, Is Not Empty |
Status | Equal, Not Equal, In, Not In, Matches, Not Matches |
List Service Instances for Service
This endpoint returns the service instances providing the service indicated on the path. Users can also build in support for dynamic load balancing and other features by incorporating the use of health checks.
The HTTP response includes the X-Consul-Results-Filtered-By-ACLs: true
header
if the response array excludes results due to ACL policy configuration.
Refer to the HTTP API documentation for more information.
Method | Path | Produces |
---|---|---|
GET | /health/service/:service | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
YES 1 | all | background refresh | node:read,service:read |
1some query parameters will use the streaming backend for blocking queries.
Path Parameters
service
(string: <required>)
- Specifies the service to list services for.
Query Parameters
dc
(string: "")
- Specifies the datacenter to query. This will default to the datacenter of the agent being queried.near
(string: "")
- Specifies a node name to sort the node list in ascending order based on the estimated round trip time from that node. Passing?near=_agent
uses the agent's node for the sort. ~> Note: Usingnear
will ignoreuse_streaming_backend
and always use blocking queries, because the data required to sort the results is not available to the streaming backend.tag
(string: "")
Deprecated - Usefilter
with theService.Tags
selector instead. This parameter will be removed in a future version of Consul. Specifies the tag to filter the list. You can use this parameter multiple times to return only the results that include all of the tag values provided.node-meta
(string: "")
Deprecated - Usefilter
with theNode.Meta
selector instead. This parameter will be removed in a future version of Consul. Specifies a desired node metadata key/value pair of the formkey:value
. This parameter can be specified multiple times, and filters the results to nodes with the specified key/value pairs.passing
(bool: false)
- Specifies that the server should return only nodes with all checks in thepassing
state. This can be used to avoid additional filtering on the client side.filter
(string: "")
- Specifies the expression used to filter the queries results prior to returning the data.peer
(string: "")
- Specifies the imported service's peer. Applies only to imported services.merge-central-config
- Include this flag in a request forconnect-proxy
kind or*-gateway
kind services to return a fully resolved service definition that includes merged values from the proxy-defaults/global and service-defaults/:service config entries. Returning a fully resolved service definition is useful when a service was registered using the /catalog/register endpoint, which does not automatically merge config entries.ns
(string: "")
Enterprise - Specifies the namespace of the service. You can also specify the namespace through other methods.
Sample Request
Sample Response
Filtering
The filter will be executed against each entry in the top level results list with the following selectors and filter operations being supported:
Selector | Supported Operations |
---|---|
Checks | Is Empty, Is Not Empty |
Checks.CheckID | Equal, Not Equal, In, Not In, Matches, Not Matches |
Checks.Name | Equal, Not Equal, In, Not In, Matches, Not Matches |
Checks.Node | Equal, Not Equal, In, Not In, Matches, Not Matches |
Checks.Notes | Equal, Not Equal, In, Not In, Matches, Not Matches |
Checks.Output | Equal, Not Equal, In, Not In, Matches, Not Matches |
Checks.ServiceID | Equal, Not Equal, In, Not In, Matches, Not Matches |
Checks.ServiceName | Equal, Not Equal, In, Not In, Matches, Not Matches |
Checks.ServiceTags | In, Not In, Is Empty, Is Not Empty |
Checks.Status | Equal, Not Equal, In, Not In, Matches, Not Matches |
Node.Address | Equal, Not Equal, In, Not In, Matches, Not Matches |
Node.Datacenter | Equal, Not Equal, In, Not In, Matches, Not Matches |
Node.ID | Equal, Not Equal, In, Not In, Matches, Not Matches |
Node.Meta | Is Empty, Is Not Empty, In, Not In |
Node.Meta.<any> | Equal, Not Equal, In, Not In, Matches, Not Matches |
Node.Node | Equal, Not Equal, In, Not In, Matches, Not Matches |
Node.TaggedAddresses | Is Empty, Is Not Empty, In, Not In |
Node.TaggedAddresses.<any> | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Address | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Connect.Native | Equal, Not Equal |
Service.EnableTagOverride | Equal, Not Equal |
Service.ID | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Kind | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Meta | Is Empty, Is Not Empty, In, Not In |
Service.Meta.<any> | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Port | Equal, Not Equal |
Service.Proxy.DestinationServiceID | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Proxy.DestinationServiceName | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Proxy.LocalServiceAddress | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Proxy.LocalServicePort | Equal, Not Equal |
Service.Proxy.Mode | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Proxy.TransparentProxy.OutboundListenerPort | Equal, Not Equal |
Service.Proxy.MeshGateway.Mode | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Proxy.Upstreams | Is Empty, Is Not Empty |
Service.Proxy.Upstreams.Datacenter | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Proxy.Upstreams.DestinationName | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Proxy.Upstreams.DestinationNamespace | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Proxy.Upstreams.DestinationType | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Proxy.Upstreams.LocalBindAddress | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Proxy.Upstreams.LocalBindPort | Equal, Not Equal |
Service.Proxy.Upstreams.MeshGateway.Mode | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.Service | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.TaggedAddresses | Is Empty, Is Not Empty, In, Not In |
Service.TaggedAddresses.<any>.Address | Equal, Not Equal, In, Not In, Matches, Not Matches |
Service.TaggedAddresses.<any>.Port | Equal, Not Equal |
Service.Tags | In, Not In, Is Empty, Is Not Empty |
Service.Weights.Passing | Equal, Not Equal |
Service.Weights.Warning | Equal, Not Equal |
List Service Instances for Mesh-enabled Service
This endpoint returns the service instances providing a mesh-capable service in a given datacenter. This will include both proxies and native integrations. A service may register both mesh-capable and incapable services at the same time, so this endpoint may be used to filter only the mesh-capable endpoints.
The HTTP response includes the X-Consul-Results-Filtered-By-ACLs: true
header
if the response array excludes results due to ACL policy configuration.
Refer to the HTTP API documentation for more information.
Method | Path | Produces |
---|---|---|
GET | /health/connect/:service | application/json |
Parameters and response format are the same as
/health/service/:service
.
List Service Instances for Ingress Gateways Associated with a Service
1.8.0+: This API is available in Consul versions 1.8.0 and later.
This endpoint returns the service instances providing an ingress gateway for a service in a given datacenter.
The HTTP response includes the X-Consul-Results-Filtered-By-ACLs: true
header
if the response array excludes results due to ACL policy configuration.
Refer to the HTTP API documentation for more information.
Method | Path | Produces |
---|---|---|
GET | /health/ingress/:service | application/json |
Parameters and response format are the same as
/health/service/:service
.
Note: Unlike /health/connect/:service
and /health/service/:service
this
endpoint does not support the peer
query parameter and the streaming backend.
List Checks in State
This endpoint returns the checks in the state provided on the path.
The HTTP response includes the X-Consul-Results-Filtered-By-ACLs: true
header
if the response array excludes results due to ACL policy configuration.
Refer to the HTTP API documentation for more information.
Method | Path | Produces |
---|---|---|
GET | /health/state/:state | application/json |
The table below shows this endpoint's support for blocking queries, consistency modes, agent caching, and required ACLs.
Blocking Queries | Consistency Modes | Agent Caching | ACL Required |
---|---|---|---|
YES | all | none | node:read,service:read |
Path Parameters
state
(string: <required>)
- Specifies the state to query. Supported states areany
,passing
,warning
, orcritical
. Theany
state is a wildcard that can be used to return all checks.
Query Parameters
dc
(string: "")
- Specifies the datacenter to query. This will default to the datacenter of the agent being queried.near
(string: "")
- Specifies a node name to sort the node list in ascending order based on the estimated round trip time from that node. Passing?near=_agent
uses the agent's node for the sort.node-meta
(string: "")
- Specifies a desired node metadata key/value pair of the formkey:value
. This parameter can be specified multiple times, and filters the results to nodes with the specified key/value pairs.filter
(string: "")
- Specifies the expression used to filter the queries results prior to returning the data.ns
(string: "")
Enterprise - Specifies the namespace to query. You can also specify the namespace through other methods.
Sample Request
Sample Response
Filtering
The filter will be executed against each health check in the results list with the following selectors and filter operations being supported:
Selector | Supported Operations |
---|---|
CheckID | Equal, Not Equal, In, Not In, Matches, Not Matches |
Name | Equal, Not Equal, In, Not In, Matches, Not Matches |
Node | Equal, Not Equal, In, Not In, Matches, Not Matches |
Notes | Equal, Not Equal, In, Not In, Matches, Not Matches |
Output | Equal, Not Equal, In, Not In, Matches, Not Matches |
ServiceID | Equal, Not Equal, In, Not In, Matches, Not Matches |
ServiceName | Equal, Not Equal, In, Not In, Matches, Not Matches |
ServiceTags | In, Not In, Is Empty, Is Not Empty |
Status | Equal, Not Equal, In, Not In, Matches, Not Matches |
Methods to specify namespace Enterprise
The health endpoints support several methods for specifying the namespace of resources with the following order of precedence:
ns
query parameterX-Consul-Namespace
request header- Namespace is inherited from the namespace of the request's ACL token (if any)
- The
default
namespace