diff --git a/.changelog/11398.txt b/.changelog/11398.txt new file mode 100644 index 000000000..35b084571 --- /dev/null +++ b/.changelog/11398.txt @@ -0,0 +1,3 @@ +```release-note:improvement +cli: Update `nomad operator debug` bundle to include sample of clients by default +``` diff --git a/command/operator_debug.go b/command/operator_debug.go index 183722f35..6633f9c4f 100644 --- a/command/operator_debug.go +++ b/command/operator_debug.go @@ -134,7 +134,8 @@ Vault Options: Debug Options: -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= 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 to 10, set to 0 for unlimited. - -node-id=, + -node-id=, 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 nodes (up to count = max-nodes). Defaults to "all". @@ -158,7 +159,7 @@ Debug Options: -pprof-duration= Duration for pprof collection. Defaults to 1s. - -server-id=, + -server-id=, Comma separated list of Nomad server names to monitor for logs, API outputs, and pprof profiles. Accepts server names, "leader", or "all". Defaults to "all". @@ -169,8 +170,8 @@ Debug Options: necessary to get the configuration from a non-leader server. -output= - Path to the parent directory of the output directory. If not specified, an - archive is built in the current directory. + Path to the parent directory of the output directory. If specified, no + archive is built. Defaults to the current directory. ` return strings.TrimSpace(helpText) } @@ -287,7 +288,7 @@ func (c *OperatorDebugCommand) Run(args []string) int { flags.StringVar(&c.logLevel, "log-level", "DEBUG", "") flags.IntVar(&c.maxNodes, "max-nodes", 10, "") flags.StringVar(&c.nodeClass, "node-class", "", "") - flags.StringVar(&nodeIDs, "node-id", "", "") + flags.StringVar(&nodeIDs, "node-id", "all", "") flags.StringVar(&serverIDs, "server-id", "all", "") flags.BoolVar(&c.stale, "stale", false, "") 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 if len(nodeIDs) > 0 && nodeCaptureCount == 0 { - c.Ui.Error(fmt.Sprintf("Failed to retrieve clients, 0 nodes found in list: %s", nodeIDs)) - return 1 + if nodeIDs == "all" { + // 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 diff --git a/website/content/docs/commands/operator/debug.mdx b/website/content/docs/commands/operator/debug.mdx index bfb4bf295..579b4c77b 100644 --- a/website/content/docs/commands/operator/debug.mdx +++ b/website/content/docs/commands/operator/debug.mdx @@ -43,16 +43,15 @@ true. ## General Options -@include 'general_options_no_namespace.mdx' +@include 'general_options.mdx' ## Debug Options -- `-duration=2m`: Set the duration of the log monitor command. - Defaults to `"2m"`. Logs will be captured from specified servers and - nodes at `log-level`. +- `-duration=2m`: Set the duration of the debug capture. Logs will be captured from + specified servers and nodes at `log-level`. Defaults to `2m`. -- `-interval=2m`: The interval between snapshots of the Nomad state. - If unspecified, only one snapshot is captured. +- `-interval=30s`: The interval between snapshots of the Nomad state. + If unspecified, only one snapshot is captured. Defaults to `30s`. - `-log-level=DEBUG`: The log level to monitor. Defaults to `DEBUG`. @@ -61,14 +60,15 @@ true. - `-node-class=`: Filter client nodes based on node class. -- `-node-id=,`: Comma separated list of Nomad client node ids, - to monitor for logs and include pprof profiles. Accepts id prefixes, and - "all" to select all nodes (up to count = max-nodes). +- `-node-id=,`: 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 nodes (up to count = max-nodes). Defaults to `all`. - `-pprof-duration=`: Duration for pprof collection. Defaults to 1s. -- `-server-id=s1,s2`: Comma separated list of Nomad server names, "leader", or - "all" to monitor for logs and include pprof profiles. +- `-server-id=,`: Comma separated list of Nomad server names to + monitor for logs, API outputs, and pprof profiles. Accepts server names, "leader", or + "all". Defaults to `all`. - `-stale=`: If "false", the default, get membership data from the cluster leader. If the cluster is in an outage unable to establish