Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
Chris Aubuchon edited this page Feb 5, 2016 · 3 revisions

Consul /health endpoint

Subcommand Synopsis
checks Get the health checks for a service
node Get the health info for a node
service Get the nodes and health info for a service
state Get the checks in a given state

checks

API Reference

Get the checks for a service

Basic Usage

Usage: consul-cli health checks [options] service

Examples

$ ./consul-cli health checks docker
[
  {
    "Node": "default",
    "CheckID": "service:docker",
    "Name": "Service 'docker' check",
    "Status": "passing",
    "Notes": "",
    "Output": "active\n",
    "ServiceID": "docker",
    "ServiceName": "docker"
  }
]

node

API Reference

Get the health info for a node

Basic Usage

Usage: consul-cli health node [options] nodeName

Examples

$ ./consul-cli health node default
[
  {
    "Node": "default",
    "CheckID": "service:docker",
    "Name": "Service 'docker' check",
    "Status": "passing",
    "Notes": "",
    "Output": "active\n",
    "ServiceID": "docker",
    "ServiceName": "docker"
  }
]

service

API Reference

Get the nodes and health info of a service

Basic Usage

Usage: consul-cli health service [options] serviceName

Command Line Options

  • --tag
    Only return services matching tag

  • --passing
    Only return nodes with all service checks in a passing state

Examples

$ ./consul-cli health service --passing=true docker
[
  {
    "Node": {
      "Node": "default",
      "Address": "10.0.2.15"
    },
    "Service": {
      "ID": "docker",
      "Service": "docker",
      "Tags": null,
      "Port": 0,
      "Address": ""
    },
    "Checks": [
      {
        "Node": "default",
        "CheckID": "service:docker",
        "Name": "Service 'docker' check",
        "Status": "passing",
        "Notes": "",
        "Output": "active\n",
        "ServiceID": "docker",
        "ServiceName": "docker"
      },
      {
        "Node": "default",
        "CheckID": "serfHealth",
        "Name": "Serf Health Status",
        "Status": "passing",
        "Notes": "",
        "Output": "Agent alive and reachable",
        "ServiceID": "",
        "ServiceName": ""
      }
    ]
  }
]

state

API Reference

Get the checks in a given state

Basic Usage

Usage: consul-cli health checks [options] (any|unknown|passing|warning|critical)

Examples

$ ./consul-cli health state passing
[
  {
    "Node": "default",
    "CheckID": "serfHealth",
    "Name": "Serf Health Status",
    "Status": "passing",
    "Notes": "",
    "Output": "Agent alive and reachable",
    "ServiceID": "",
    "ServiceName": ""
  },
  {
    "Node": "default",
    "CheckID": "service:docker",
    "Name": "Service 'docker' check",
    "Status": "passing",
    "Notes": "",
    "Output": "active\n",
    "ServiceID": "docker",
    "ServiceName": "docker"
  }
]