Skip to content

Instantly share code, notes, and snippets.

@justahero
Last active October 23, 2017 20:11
Show Gist options
  • Save justahero/0aead4c2d4b147e4094315b7665946ef to your computer and use it in GitHub Desktop.
Save justahero/0aead4c2d4b147e4094315b7665946ef to your computer and use it in GitHub Desktop.
Cheatsheet Consul API

Consul API

The following commands assume a running consul instance on localhost:8500.

Agent + Health

List all checks from local node

$ curl -X GET 'localhost:8500/v1/agent/checks'

List all services from local node

$ curl -X GET 'localhost:8500/v1/agent/services'

List all services from the whole catalog

$ curl -X GET 'localhost:8500/v1/catalog/services'

List health checks of a single node

$ curl -X GET 'localhost:8500/v1/health/node/:node'

List health checks for a single service

$ curl -X GET 'localhost:8500/v1/health/checks/:service'

List all nodes where a given service exist

$ curl -X GET 'localhost:8500/v1/health/service/:service'

List checks in a given state, where state is one of passing, warning, critical

$ curl -X GET 'localhost:8500/v1/health/state/:state'

Nodes + Cluster

List all members of the Consul cluster

$ curl -X GET 'localhost:8500/v1/agent/members'

List all nodes of the Consul catalog

$ curl -X GET 'localhost:8500/v1/catalog/nodes'

List the configuration of a single node

$ curl -X GET 'localhost:8500/v1/agent/self'

View the metrics of the last measured interval

$ curl -X GET 'localhost:8500/v1/agent/metrics'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment