- gcloud alpha compute diagnose sosreport - sosreport run from a Google Compute Engine VM
gcloud alpha compute diagnose sosreport
(ALPHA)This command is designed to obtain relevant debug information from a VM in a standard way for expediting support cases.
The actual information scraping is done by the Sosreport tool (https://github.com/sosreport/sos). This command is a wrapper that handles installation, running and (optionally) copying the result.
The location of the tool download and report generation are defaulted to the /tmp directory, but can be modified through flags. The user can use the --download-dir flag to specify a location where the command can download the resulting from the VM.
NOTE: For this command to work, git needs to be installed within the VM, in order to clone the repository and run the code from there.
NOTE: Sosreport is somewhat geared towards Python 3.x, as it uses APIs that had to be back-ported to Python 2.7 (notably concurrent). If the default installation of Python is 2.7, it is possible that the Sosreport run fails. To fix this either install the dependencies for Python 2.7 or use python-path to specify the path to another Python installation that works, normally it being a Python 3.x binary.
- POSITIONAL ARGUMENTS
- Name of the instance to run Sosreport on. For details on valid instance names, refer to the criteria documented under the field 'name' at: https://cloud.google.com/compute/docs/reference/rest/v1/instances
- Local dir to which to download the report generated in the VM. If not specified, no download will be done. The download will be done using a no-configuration gcloud compute scp command. For more complicated setups, manual download will be required.
- Print the equivalent scp/ssh command that would be run to stdout, instead of executing it.
If enabled, the gcloud command-line tool will regenerate and overwrite the files
associated with a broken SSH key without asking for confirmation in both
interactive and non-interactive environments.
If disabled, the files associated with a broken SSH key will not be regenerated and will fail in both interactive and non-interactive environments.
Suppress the automatic addition of
scp(1)flags. This flag is useful if you want to take care of authentication yourself or use specific ssh/scp features.
- Path to the python binary to be called. Sosreport is a python tool which is called by default with the default python installation. This overrides that calls and uses the provided python binary.
- Remote location (within the VM) to write the reports into.
- Remote location (within the VM) to clone sosreport into.
Additional flags to be passed to
ssh(1). It is recommended that flags be passed using an assignment operator and quotes. This flag will replace occurrences of ``%USER%"" and ``%INSTANCE%"" with their dereferenced values. Example:
$ gcloud alpha compute diagnose sosreport example-instance \ --zone us-central1-a --ssh-flag="-vvv" \ --ssh-flag="-L 80:%INSTANCE%:80"
is equivalent to passing the flags ``--vvv"" and ``-L 80:188.8.131.52:80"" to
ssh(1)if the external IP address of "example-instance" is 184.108.40.206.
The path to the SSH key file. By default, this is
Override the default behavior of StrictHostKeyChecking for the connection. By
default, StrictHostKeyChecking is set to 'no' the first time you connect to an
instance, and will be set to 'yes' for all subsequent connections.
STRICT_HOST_KEY_CHECKINGmust be one of:
- User for login to the selected VMs. If not specified, the default user will be used.
Zone of the instance to run Sosreport on. If not specified, the user may be
prompted to select a zone.
gcloudwill attempt to identify the zone by searching for resources in the user's project. If the zone cannot be determined, the user will then be prompted with all Google Cloud Platform zones.
To avoid prompting when this flag is omitted, the user can set the
$ gcloud config set compute/zone ZONE
A list of zones can be fetched by running:
To unset the property, run:
$ gcloud config unset compute/zone
Alternatively, the zone can be stored in the environment variable
At most one of these may be specified:
- The time when the ssh key will be valid until, such as "2017-08-29T18:52:51.142Z." This is only valid if the instance is not using OS Login. See $ gcloud topic datetimes for information on time formats.
- The maximum length of time an SSH key is valid for once created and installed, e.g. 2m for 2 minutes. See $ gcloud topic datetimes for information on duration formats.
- GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account,
--log-http, --project, --quiet, --trace-token, --user-output-enabled,
$ gcloud helpfor details.
To obtain relevant debug information from a VM, run:
$ gcloud alpha compute diagnose sosreport
- This command is currently in ALPHA and may change without notice. If this command fails with API permission errors despite specifying the right project, you may be trying to access an API with an invitation-only early access whitelist.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-02-04.