Files
nomad/website/content/docs/commands/alloc/checks.mdx
Aimee Ukasick 23fd87d9c9 Docs: Commands section move "General options" to page bottom (#26001)
* sectionless files plus acl section

* alloc section

* config, deployment sections

* job section

* licence, namespace

* node, node-pool

* operator

* plugin, quota, recommendation

* scaling, sentinel, server, service, system, var, volume

* Add "ENT" label to left nav for enterprise commands

* job tag break into separate folder and files; update options header
2025-06-12 14:31:38 -05:00

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.
## 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
```
## General options
@include 'general_options.mdx'