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 · 2 revisions

Consul /agent endpoint

Subcommand Synopsis
checks Get the checks the agent is managing
force-leave Force the removal of a node
join Trigger the local agent to join a node
maintenance Manage node maintenance mode
members Get the members as seen by the serf agent
self Get agent configuration
services Get the services the agent is managing

checks

API Reference

Get the checks that the agent is managing

Basic Usage

Usage: consul-cli agent checks [options]

Examples

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

force-leave

API Reference

Force the removal of a node

Basic Usage

Usage: consul-cli agent force-leave [options] nodeName

Examples

$ ./consul-cli agent force-leave mi-control-01

join

API Reference

Triggers the agent to join a node

Basic Usage

Usage: consul-cli agent join [options] nodeName

Command Line Options

  • --wan
    When true, attempt to join a WAN pool instead of a LAN pool. Default is false

Examples

$ ./consul-cli agent join mi-control-01

maintenance

API Reference

Manages node maintenance mode

Basic Usage

Usage: consul-cli agent maintenance [options]

Command Line Options

  • --enabled
    When true, enable maintenance mode on the agent. Default is true

  • --reason
    Optional text explaining the reason for putting the node in maintenance mode

Examples

$ ./consul-cli agent maintenance --enable=true --reason="Maintenance Testing"

members

API Reference

Get the cluster members as seen by the local Serf agent.

Basic Usage

Usage: consul-cli agent members [options]

Command Line Options

  • --wan Get the list of WAN pool members instead of LAN pool members

Examples

$ ./consul-cli agent members
[
  {
    "Name": "default",
    "Addr": "10.0.2.15",
    "Port": 8301,
    "Tags": {
      "bootstrap": "1",
      "build": "0.5.2:9a9cc934",
      "dc": "vagrant",
      "port": "8300",
      "role": "consul",
      "vsn": "2",
      "vsn_max": "2",
      "vsn_min": "1"
    },
    "Status": 1,
    "ProtocolMin": 1,
    "ProtocolMax": 2,
    "ProtocolCur": 2,
    "DelegateMin": 2,
    "DelegateMax": 4,
    "DelegateCur": 4
  }
]

self

API Reference

Get the local node configuration

Basic Usage

Usage: consul-cli agent self [options]

Examples

$ ./consul-cli agent self
{
  "Config": {
    "ACLDatacenter": "vagrant",
    "ACLDefaultPolicy": "allow",
    "ACLDownPolicy": "allow",
    "ACLTTL": 3e+10,
    "ACLTTLRaw": "",
    "Addresses": {
      "DNS": "",
      "HTTP": "",
      "HTTPS": "",
      "RPC": ""
    },
...
  }
}

services

API Reference

Get services managed by the agent

Basic Usage

Usage: consul-cli agent services [options]

Examples

$ ./consul-cli agent services
{
    "docker": {
    "ID": "docker",
    "Service": "docker",
    "Tags": null,
    "Port": 0,
    "Address": ""
  }
}