debug: update default node-id and docs (#11398)

* debug: default node-id to all
* debug: align cli help and website documentation
This commit is contained in:
Dave May 2021-10-27 13:43:56 -04:00 committed by GitHub
parent cdddd64a42
commit 509c74ce19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 19 deletions

3
.changelog/11398.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
cli: Update `nomad operator debug` bundle to include sample of clients by default
```

View File

@ -134,7 +134,8 @@ Vault Options:
Debug Options: Debug Options:
-duration=<duration> -duration=<duration>
The duration of the log monitor command. Defaults to 2m. Set the duration of the debug capture. Logs will be captured from specified servers and
nodes at "log-level". Defaults to 2m.
-interval=<interval> -interval=<interval>
The interval between snapshots of the Nomad state. Set interval equal to The interval between snapshots of the Nomad state. Set interval equal to
@ -147,7 +148,7 @@ Debug Options:
Cap the maximum number of client nodes included in the capture. Defaults Cap the maximum number of client nodes included in the capture. Defaults
to 10, set to 0 for unlimited. to 10, set to 0 for unlimited.
-node-id=<node>,<node> -node-id=<node1>,<node2>
Comma separated list of Nomad client node ids to monitor for logs, API Comma separated list of Nomad client node ids to monitor for logs, API
outputs, and pprof profiles. Accepts id prefixes, and "all" to select all outputs, and pprof profiles. Accepts id prefixes, and "all" to select all
nodes (up to count = max-nodes). Defaults to "all". nodes (up to count = max-nodes). Defaults to "all".
@ -158,7 +159,7 @@ Debug Options:
-pprof-duration=<duration> -pprof-duration=<duration>
Duration for pprof collection. Defaults to 1s. Duration for pprof collection. Defaults to 1s.
-server-id=<server>,<server> -server-id=<server1>,<server2>
Comma separated list of Nomad server names to monitor for logs, API Comma separated list of Nomad server names to monitor for logs, API
outputs, and pprof profiles. Accepts server names, "leader", or "all". outputs, and pprof profiles. Accepts server names, "leader", or "all".
Defaults to "all". Defaults to "all".
@ -169,8 +170,8 @@ Debug Options:
necessary to get the configuration from a non-leader server. necessary to get the configuration from a non-leader server.
-output=<path> -output=<path>
Path to the parent directory of the output directory. If not specified, an Path to the parent directory of the output directory. If specified, no
archive is built in the current directory. archive is built. Defaults to the current directory.
` `
return strings.TrimSpace(helpText) return strings.TrimSpace(helpText)
} }
@ -287,7 +288,7 @@ func (c *OperatorDebugCommand) Run(args []string) int {
flags.StringVar(&c.logLevel, "log-level", "DEBUG", "") flags.StringVar(&c.logLevel, "log-level", "DEBUG", "")
flags.IntVar(&c.maxNodes, "max-nodes", 10, "") flags.IntVar(&c.maxNodes, "max-nodes", 10, "")
flags.StringVar(&c.nodeClass, "node-class", "", "") flags.StringVar(&c.nodeClass, "node-class", "", "")
flags.StringVar(&nodeIDs, "node-id", "", "") flags.StringVar(&nodeIDs, "node-id", "all", "")
flags.StringVar(&serverIDs, "server-id", "all", "") flags.StringVar(&serverIDs, "server-id", "all", "")
flags.BoolVar(&c.stale, "stale", false, "") flags.BoolVar(&c.stale, "stale", false, "")
flags.StringVar(&output, "output", "", "") flags.StringVar(&output, "output", "", "")
@ -450,8 +451,13 @@ func (c *OperatorDebugCommand) Run(args []string) int {
// Return error if nodes were specified but none were found // Return error if nodes were specified but none were found
if len(nodeIDs) > 0 && nodeCaptureCount == 0 { if len(nodeIDs) > 0 && nodeCaptureCount == 0 {
c.Ui.Error(fmt.Sprintf("Failed to retrieve clients, 0 nodes found in list: %s", nodeIDs)) if nodeIDs == "all" {
return 1 // It's okay to have zero clients for default "all"
c.Ui.Info("Note: \"-node-id=all\" specified but no clients found")
} else {
c.Ui.Error(fmt.Sprintf("Failed to retrieve clients, 0 nodes found in list: %s", nodeIDs))
return 1
}
} }
// Resolve servers // Resolve servers

View File

@ -43,16 +43,15 @@ true.
## General Options ## General Options
@include 'general_options_no_namespace.mdx' @include 'general_options.mdx'
## Debug Options ## Debug Options
- `-duration=2m`: Set the duration of the log monitor command. - `-duration=2m`: Set the duration of the debug capture. Logs will be captured from
Defaults to `"2m"`. Logs will be captured from specified servers and specified servers and nodes at `log-level`. Defaults to `2m`.
nodes at `log-level`.
- `-interval=2m`: The interval between snapshots of the Nomad state. - `-interval=30s`: The interval between snapshots of the Nomad state.
If unspecified, only one snapshot is captured. If unspecified, only one snapshot is captured. Defaults to `30s`.
- `-log-level=DEBUG`: The log level to monitor. Defaults to `DEBUG`. - `-log-level=DEBUG`: The log level to monitor. Defaults to `DEBUG`.
@ -61,14 +60,15 @@ true.
- `-node-class=<node-class>`: Filter client nodes based on node class. - `-node-class=<node-class>`: Filter client nodes based on node class.
- `-node-id=<node1>,<node2>`: Comma separated list of Nomad client node ids, - `-node-id=<node1>,<node2>`: Comma separated list of Nomad client node ids
to monitor for logs and include pprof profiles. Accepts id prefixes, and to monitor for logs, API outputs, and pprof profiles. Accepts id prefixes, and
"all" to select all nodes (up to count = max-nodes). "all" to select all nodes (up to count = max-nodes). Defaults to `all`.
- `-pprof-duration=<duration>`: Duration for pprof collection. Defaults to 1s. - `-pprof-duration=<duration>`: Duration for pprof collection. Defaults to 1s.
- `-server-id=s1,s2`: Comma separated list of Nomad server names, "leader", or - `-server-id=<server1>,<server2>`: Comma separated list of Nomad server names to
"all" to monitor for logs and include pprof profiles. monitor for logs, API outputs, and pprof profiles. Accepts server names, "leader", or
"all". Defaults to `all`.
- `-stale=<true|false>`: If "false", the default, get membership data from the - `-stale=<true|false>`: If "false", the default, get membership data from the
cluster leader. If the cluster is in an outage unable to establish cluster leader. If the cluster is in an outage unable to establish