-
Notifications
You must be signed in to change notification settings - Fork 65
Check
| 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 a check with the agent
Usage: consul-cli check register [options] checkName-
--id
The service ID. If--idis not provided thencheckNameis 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,--scriptor--ttlcan be specified -
--script
Path to a local command that is run every interval. Only one of--http,--scriptor--ttlcan be specified -
--ttl
The duration that Consul will wait before marking the service ascritical. In this mode, the application must update the status via thepass,warnorfailendpoints before the TTL expires. Only one of--http,--scriptor--ttlcan be specified -
--interval
For--httpand--scriptcheck types, the time between execution of the check. -
--service-id
Service ID to associate the check with -
--notes
Text description of the check
$ ./consul-cli check register --id='test:ttl' --ttl=2m testTTLDeregisters a check from the agent
Usage: consul-cli check deregister [options] checkId$ ./consul-cli check deregister 'test:ttl'
$Mark a check as passing
Usage: consul-cli check pass [options] checkId-
--note
Text message to associate with the check status
$ ./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": ""
}
}Mark a check as critical
Usage: consul-cli check fail [options] checkId-
--note
Text message to associate with the check status
$ ./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": ""
}
}Mark a check as warning
Usage: consul-cli check warn [options] checkId-
--note
Text message to associate with the check status
$ ./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": ""
}
}