diag gather-diagnostics

Gather diagnostic information about the services associated with an instance of IBM Software Hub and create a diagnostics log.

Extended description

When you run the gather-diagnostics command, you must specify the services that you want to gather information about. Run the diag list-services command to get a list of the services that you can gather diagnostic data for. Diagnostic information for the dependencies of these services is automatically included in the log.

If the privileged monitoring service is installed, the gather-diagnostics command collects more logs and resources in the diagnostics log file.
  • Pod container logs for the operator namespace are saved in the IBM® Software Hub folder.
  • Health check information is saved as YAML files in the Healthcheck folder. These resources include:
    • Cluster resources, which include nodes, node metrics, cluster operators, machine config pools, and certificate signing requests.
    • Operator resources, which include cluster service versions, catalog sources, subscriptions, install plans, operator groups, operand requests, pods, and deployments.
    • Operand resources, which include IBM Software Hub service custom resources, operand configs, operand registries, and operand bind information.

For more information, see Installing privileged monitors.

Prerequisites

Before you can complete certain IBM Software Hub setup and management tasks, you must create a profile so that you can run the appropriate cpd-cli commands. A profile enables the cpd-cli to verify that you are a IBM Software Hub user and that you have the appropriate administrator permissions to complete a task. For more information, see Creating a profile to use the cpd-cli management commands.

Syntax

cpd-cli diag gather-diagnostics <product-id> \
[--file-path=<./cpd-cli-workspace/custom-serviceability.json>]
[--from=<year-month-dayTh:m:s-05:00>] \
[--output=json|yaml|text] \
[--products-json] \
--profile=<profile-name>] \
[--to=<year-month-dayTh:m:s-05:00>] \
[--verbose]

Arguments

Table 1: Command options
Argument Description
<product-id> One or more product IDs (in a comma-separated list) to gather diagnostics for.

Options

Table 1: Command options
Option Description

--file-path

The path to a JSON file containing custom serviceability data of products.

Use the customized JSON file to gather custom diagnostic data. Obtain file using --custom while running the cpd-cli diag list-services command, and edit it to specify the diagnostic logs you require.

Status
Optional if <product-id> or --products-json is provided.
Syntax
--file-path=<./cpd-cli-workspace/custom-serviceability.json>
Default value
No default.
Valid values
Valid file path to the JSON file.

--from

-f

The RFC3339 format timestamp from which to begin gathering diagnostics.
Status
Optional.
Syntax
--from=<year-month-dayTh:m:s-05:00>
Default value
The option defaults to 30 minutes before the current time when a timestamp is not specified.
Valid values
A RFC3339 format timestamp.

--help

-h

Display command help.
Status
Optional.
Syntax
--help
Default value
No default.
Valid values
Not applicable.

--output

-o

Specify an output format.
Status
Optional.
Syntax
--output=json|yaml|text
Default value
text
Valid values
Valid formats include JSON, YAML, or text (the default format).

--products-json

Products data in JSON format.
Status
Optional if <product-id> or --file-path is provided.
Syntax
--products-json
Default value
Valid JSON string containing products data.
Valid values
Valid file path to the JSON file.
--profile The name of the profile that you created to store information about an instance of IBM Software Hub and your credentials for the instance.
Status
Required.
Syntax
--profile=<profile-name>
Default value
No default.
Valid values

The name of the profile that you created.

--to

-t

The RFC3339 format timestamp from which to stop gathering diagnostics.
Status
Optional.
Syntax
--to=<year-month-dayTh:m:s-05:00>
Default value
The option defaults to the current time when a timestamp is not specified.
Valid values
An RFC3339 format timestamp.
--verbose Logs include more detailed messages.
Status
Optional.
Syntax
--verbose
Default value
No default.
Valid values
Not applicable.

Examples

Note: The following examples use the recommended installation environment variables.

It is strongly recommended that you use a script to create environment variables with the correct values for your environment. For more information, see Setting up installation environment variables.

Retrieve the diagnostics logs from a IBM Software Hub service.
cpd-cli diag gather-diagnostics <product-id> \
--profile=${CPD_PROFILE_NAME}
Retrieve custom diagnostics logs from a IBM Software Hub service.
cpd-cli diag gather-diagnostics <product-id>\
--profile default\
--file-path=<./cpd-cli-workspace/custom-serviceability.json>\
--from=<year-month-dayTh:m:s-05:00>\    
--to= <year-month-dayTh:m:s-05:00>