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 /agent/check endpoint

Subcommand Synopsis
deregister Remove a check from the agent
fail Mark a local check as critical
pass Mark a local check as passing
register Register a new local check
warn Mark a local check as warning

register

API Reference

Register a check with the agent

Basic Usage

Usage: consul-cli check register [options] checkName

Command Line Options

  • --id
    The service ID. If --id is not provided then checkName is used. There cannot be duplicate IDs per agent so it may be necessary to specify an id

  • --http
    A URL to check every interval. Only one of --http, --script or --ttl can be specified

  • --script
    Path to a local command that is run every interval. Only one of --http, --script or --ttl can be specified

  • --ttl
    The duration that Consul will wait before marking the service as critical. In this mode, the application must update the status via the pass, warn or fail endpoints before the TTL expires. Only one of --http, --script or --ttl can be specified

  • --interval
    For --http and --script check types, the time between execution of the check.

  • --service-id
    Service ID to associate the check with

  • --notes
    Text description of the check

Examples

$ ./consul-cli check register --id='test:ttl' --ttl=2m testTTL

deregister

API Reference

Deregisters a check from the agent

Basic Usage

Usage: consul-cli check deregister [options] checkId

Examples

$ ./consul-cli check deregister 'test:ttl'
$

pass

API Reference

Mark a check as passing

Basic Usage

Usage: consul-cli check pass [options] checkId

Command Line Options

  • --note
    Text message to associate with the check status

Examples

$ ./consul-cli check pass 'test:ttl'
$ ./consul-cli agent checks
{
  "test:ttl": {
    "Node": "default",
    "CheckID": "test:ttl",
    "Name": "testTTL",
    "Status": "passing",
    "Notes": "",
    "Output": "",
    "ServiceID": "",
    "ServiceName": ""
  }
}

fail

API Reference

Mark a check as critical

Basic Usage

Usage: consul-cli check fail [options] checkId

Command Line Options

  • --note
    Text message to associate with the check status

Examples

$ ./consul-cli check fail 'test:ttl' 
$ ./consul-cli agent checks
{
  "test:ttl": {
    "Node": "default",
    "CheckID": "test:ttl",
    "Name": "testTTL",
    "Status": "critical",
    "Notes": "",
    "Output": "",
    "ServiceID": "",
    "ServiceName": ""
  }
}

warn


API Reference

Mark a check as warning

Basic Usage

Usage: consul-cli check warn [options] checkId

Command Line Options

  • --note
    Text message to associate with the check status

Examples

$ ./consul-cli check warn 'test:ttl' 
$ ./consul-cli agent checks
{
  "test:ttl": {
    "Node": "default",
    "CheckID": "test:ttl",
    "Name": "testTTL",
    "Status": "warning",
    "Notes": "",
    "Output": "",
    "ServiceID": "",
    "ServiceName": ""
  }
}