Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug: update default node-id and docs #11398

Merged
merged 4 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions command/operator_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ Vault Options:
Debug Options:

-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>
The interval between snapshots of the Nomad state. Set interval equal to
Expand All @@ -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>,<node>
-node-id=<node1>,<node2>
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".
Expand All @@ -158,7 +159,7 @@ Debug Options:
-pprof-duration=<duration>
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
outputs, and pprof profiles. Accepts server names, "leader", or "all".
Defaults to "all".
Expand All @@ -169,8 +170,8 @@ Debug Options:
necessary to get the configuration from a non-leader server.

-output=<path>
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
davemay99 marked this conversation as resolved.
Show resolved Hide resolved
archive is built. Defaults to the current directory.
`
return strings.TrimSpace(helpText)
}
Expand Down Expand Up @@ -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", "", "")
Expand Down Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions website/content/docs/commands/operator/debug.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

Expand All @@ -61,14 +60,15 @@ true.

- `-node-class=<node-class>`: Filter client nodes based on node class.

- `-node-id=<node1>,<node2>`: 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=<node1>,<node2>`: 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>`: 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=<server1>,<server2>`: 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=<true|false>`: If "false", the default, get membership data from the
cluster leader. If the cluster is in an outage unable to establish
Expand Down