mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 02:45:42 +03:00
* Enhance front matter description for search * acl section * alloc section * config section * deployment section * eval section * job section * license section * namespace section * node section * node pool section * operator section * plugin section * quota section * recommendation section * scaling section * sentinel section * server section * service section * setup section * system section * tls section * var section * volume section * change reference to command reference * Apply suggestions from code review Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com> --------- Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
87 lines
2.2 KiB
Plaintext
87 lines
2.2 KiB
Plaintext
---
|
|
layout: docs
|
|
page_title: 'nomad alloc checks command reference'
|
|
description: |
|
|
The `nomad alloc checks` command displays service health check status information for an allocation.
|
|
---
|
|
|
|
# `nomad alloc checks` command reference
|
|
|
|
|
|
The `alloc checks` command outputs the latest health check status information for checks in the allocation.
|
|
|
|
## Usage
|
|
|
|
```plaintext
|
|
nomad alloc checks [options] <allocation>
|
|
```
|
|
|
|
Outputs the latest health check status information for services in the allocation
|
|
using the Nomad service discovery provider. This command accepts an allocation
|
|
ID or prefix as the sole argument.
|
|
|
|
When ACLs are enabled, this command requires a token with the 'read-job' capability
|
|
for the allocation's namespace. The 'list-jobs' capability is required to run the
|
|
command with an allocation ID prefix instead of the exact allocation ID.
|
|
|
|
## General options
|
|
|
|
@include 'general_options.mdx'
|
|
|
|
## Checks options
|
|
|
|
- `-verbose`: Display verbose output.
|
|
|
|
- `-json`: Output the allocation in its JSON format.
|
|
|
|
- `-t`: Format and display the health checks status using a Go template.
|
|
|
|
## Examples
|
|
|
|
Show checks of an alloc health check using its short ID:
|
|
|
|
```shell-session
|
|
$ nomad alloc checks e0fdbd85
|
|
|
|
Status of 1 Nomad Service Checks
|
|
|
|
ID = 9f4e18fd0867cebb19a8fac3d7a1cf27
|
|
Name = alive
|
|
Group = example.cache[0]
|
|
Task = (group)
|
|
Service = redis-cache
|
|
Status = success
|
|
Mode = healthiness
|
|
Timestamp = 2023-03-09T16:10:23+01:00
|
|
Output = nomad: tcp ok
|
|
```
|
|
|
|
The `-json` flag can be used to get the health checks status in json format:
|
|
|
|
```shell-session
|
|
nomad alloc checks -json 54fde4f8
|
|
|
|
{
|
|
"9810e90177a4c21ce3bfe04dc7da6131": {
|
|
"Check": "alive",
|
|
"Group": "example.cache[0]",
|
|
"ID": "9810e90177a4c21ce3bfe04dc7da6131",
|
|
"Mode": "healthiness",
|
|
"Output": "nomad: tcp ok",
|
|
"Service": "redis-cache",
|
|
"Status": "success",
|
|
"StatusCode": 0,
|
|
"Task": "",
|
|
"Timestamp": 1678444309
|
|
}
|
|
}
|
|
```
|
|
|
|
Or use the `-t` flag to format and display the health checks using a Go template:
|
|
|
|
```shell-session
|
|
$ nomad alloc checks -t '{{range .}}{{ printf "%s: %s\n" .ID .Status }}{{end}}' 54
|
|
|
|
9810e90177a4c21ce3bfe04dc7da6131: success
|
|
```
|