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

PBM-887 Documented pbm diagnostic command #226

Merged
merged 7 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions docs/reference/pbm-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,24 @@
| `replsets` | The list of replica sets included in the restore. Each replica set has the following fields: <br> - `name` - the replica set name <br> - `status` - the restore status on this replica set <br> - `error` - the error message for failed restore <br> - `last_transition_time` - the human-readable indication of the time when the restore process changed its status <br> - `nodes` - the list of nodes included in the restore. |
| `replsets.nodes` | The list of nodes included in the restore. Each node has the following fields: <br> - `name` - the node name and port <br> - `status` - the restore status on the node <br> - `error` - the error message for failed restore <br> - `last_transition_time` - the human-readable indication of the time when the restore process changed its status |

## pbm diagnostic

Check warning on line 405 in docs/reference/pbm-commands.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/reference/pbm-commands.md#L405

[Google.Headings] 'pbm diagnostic' should use sentence-style capitalization.
Raw output
{"message": "[Google.Headings] 'pbm diagnostic' should use sentence-style capitalization.", "location": {"path": "docs/reference/pbm-commands.md", "range": {"start": {"line": 405, "column": 4}}}, "severity": "WARNING"}

Generates the report with the detailed information about a specific backup or a restore. You can also use it for other commands. To learn more, refer to the [Diagnostics report](../troubleshoot/pbm-report.md).

The command has the following syntax:

```{.bash data-prompt="$"}
$ pbm diagnose --path path --name <backup-name> --opid <OPID>
```

The command accepts the following flags:

| Flag | Description |
| ------------------- | -------------------------------- |
| `--path` | The path where to save the report. If the directory doesn’t exist, PBM creates it during the report generation. Make sure that the user that runs PBM CLI has write access to the specified path |

Check warning on line 419 in docs/reference/pbm-commands.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/reference/pbm-commands.md#L419

[Google.WordList] Use 'command-line tool' instead of 'CLI'.
Raw output
{"message": "[Google.WordList] Use 'command-line tool' instead of 'CLI'.", "location": {"path": "docs/reference/pbm-commands.md", "range": {"start": {"line": 419, "column": 175}}}, "severity": "WARNING"}
| `--name` | The name of the required backup or a restore |
| `--opid` | The unique Operation ID of the specified command. You can retrieve it from the `pbm logs`, `pbm describe-backup` / `pbm describe-restore` output. |
| `--archive` | Creates a .zip archive of the report in the specified path.|


## pbm help
Expand Down
83 changes: 83 additions & 0 deletions docs/troubleshoot/pbm-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Diagnostics report

!!! admonition "Version added: [2.8.0](../release-notes/2.8.0.md)"

When troubleshooting issues with backups and restores, viewing logs and PBM status may sometimes not be enough to identify the root of the issue.

Starting with version 2.8.0 you can generate a diagnostics report about a specific backup, restore, or other commands. The report includes the following information:

* The information about the environment: pbm-agents statuses, cluster members, etc.
* Logs collected between the start and end time of the command execution
* If it is a backup command, the backup metadata file.

Check notice on line 11 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L11

[Google.Contractions] Use 'it's' instead of 'it is'.
Raw output
{"message": "[Google.Contractions] Use 'it's' instead of 'it is'.", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 11, "column": 6}}}, "severity": "INFO"}
* If it is a restore command, the restore metadata file and the backup metadata file.

Check notice on line 12 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L12

[Google.Contractions] Use 'it's' instead of 'it is'.
Raw output
{"message": "[Google.Contractions] Use 'it's' instead of 'it is'.", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 12, "column": 6}}}, "severity": "INFO"}

<i warning>:material-alert: Warning:</i> Physical restore is not supported at the moment.

Check warning on line 14 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L14

[Google.Colons] ': W' should be in lowercase.
Raw output
{"message": "[Google.Colons] ': W' should be in lowercase.", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 14, "column": 30}}}, "severity": "WARNING"}

Check notice on line 14 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L14

[Google.Contractions] Use 'isn't' instead of 'is not'.
Raw output
{"message": "[Google.Contractions] Use 'isn't' instead of 'is not'.", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 14, "column": 62}}}, "severity": "INFO"}

This data is stored in separate files in JSON format.

Check notice on line 16 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L16

[Google.Passive] In general, use active voice instead of passive voice ('is stored').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('is stored').", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 16, "column": 11}}}, "severity": "INFO"}

To generate a report, run the `pbm diagnostics` command:

```{.bash data-prompt="$"}
$ pbm diagnostic --path=path --name=<backup-name>
```

or you can use the OPID of the command:

Check notice on line 24 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L24

[Google.Acronyms] Spell out 'OPID', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'OPID', if it's unfamiliar to the audience.", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 24, "column": 20}}}, "severity": "INFO"}

```{.bash data-prompt="$"}
$ pbm diagnostic --path=path --opid=<OPID>
```

sandraromanchenko marked this conversation as resolved.
Show resolved Hide resolved
where:

* `path` is the path where to save the report. If the directory doesn’t exist, PBM creates it during the report generation. Make sure that the user that runs PBM CLI has write access to the specified path.

Check warning on line 32 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L32

[Google.WordList] Use 'command-line tool' instead of 'CLI'.
Raw output
{"message": "[Google.WordList] Use 'command-line tool' instead of 'CLI'.", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 32, "column": 163}}}, "severity": "WARNING"}
* `OPID` is the unique Operation ID of the specified command. You can retrieve it from the `pbm logs`, `pbm describe-backup` / `pbm describe-restore` output.
* `name` is the name of the required backup or a restore. You can use it instead of OPID for backups and restores.

Check notice on line 34 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L34

[Google.Acronyms] Spell out 'OPID', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'OPID', if it's unfamiliar to the audience.", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 34, "column": 85}}}, "severity": "INFO"}

**Usage example**

For example, your `pbm status` output has the following backup:

```{.text .no-copy}
Backups:
========
S3 us-east-1 http://minio:9000/mybackups
Snapshots:
2024-11-27T13:49:31Z 95.79KB <logical> [restore_to_time: 2024-11-27T13:49:37Z]
```

To retrieve the OpID of the backup operation, run the `pbm describe-backup` command as follows:

```{.bash data-prompt="$"}
$ pbm describe-backup 2024-11-27T13:49:31Z | grep 'opid'
```

The output returns the OpID:

```{.text .no-copy}
opid: 6747236bfa98f6a85b9bd4e7
```

Now you can generate the diagnostics report:

```{.bash data-prompt="$"}
$ pbm diagnostic --path=/tmp/backup_report --opid=6747236bfa98f6a85b9bd4e7
```

Check the generated files:

```{.bash data-prompt="$"}
$ ls /tmp/backup_report
6747236bfa98f6a85b9bd4e7.backup.json 6747236bfa98f6a85b9bd4e7.log 6747236bfa98f6a85b9bd4e7.report.json
```

You can use the OPID to generate a diagnostics report about other operations like cleanup, cancellation, etc. In this case the report contains only the information about your environment and logs collected during the operation execution.

Check notice on line 73 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L73

[Google.Acronyms] Spell out 'OPID', if it's unfamiliar to the audience.
Raw output
{"message": "[Google.Acronyms] Spell out 'OPID', if it's unfamiliar to the audience.", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 73, "column": 17}}}, "severity": "INFO"}

You can also output the report into an archive file as follows:

```{.bash data-prompt="$"}
$ pbm diagnostic --path=path --opid=<OPID> --archive
```

The diagnostics report empowers you to collect every necessary aspect for deep analysis of issues with a specific operation, all in one go. If you can't perform the analysis yourself, `pbm diagnostic` offers a quick and convenient way to collect and submit all relevant information for filing a bug report. This significantly reduces the interaction time between you and our experts, accelerating issue resolution.

Check warning on line 81 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L81

[Google.We] Try to avoid using first-person plural like 'our'.
Raw output
{"message": "[Google.We] Try to avoid using first-person plural like 'our'.", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 81, "column": 372}}}, "severity": "WARNING"}

Percona customers have the advantage of their bug reports being prioritized higher. If you're interested in enjoying these benefits, [contact us today :octicons-link-external-16:](https://www.percona.com/about/contact).

Check notice on line 83 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L83

[Google.Passive] In general, use active voice instead of passive voice ('being prioritized').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('being prioritized').", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 83, "column": 59}}}, "severity": "INFO"}

Check warning on line 83 in docs/troubleshoot/pbm-report.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/troubleshoot/pbm-report.md#L83

[Google.We] Try to avoid using first-person plural like 'us'.
Raw output
{"message": "[Google.We] Try to avoid using first-person plural like 'us'.", "location": {"path": "docs/troubleshoot/pbm-report.md", "range": {"start": {"line": 83, "column": 143}}}, "severity": "WARNING"}
1 change: 1 addition & 0 deletions mkdocs-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ nav:
- Overview: troubleshoot/index.md
- 'Diagnose PBM': 'troubleshoot/troubleshooting.md'
- 'Check status': 'troubleshoot/status.md'
- 'Diagnostics report': 'troubleshoot/pbm-report.md'
- 'Troubleshoot backup management via PMM': 'troubleshoot/pbm-pmm.md'
- troubleshoot/faq.md
- Release notes:
Expand Down