gcloud alpha compute diagnose sosreport - sosreport run from a Compute Engine VM
gcloud alpha compute diagnose sosreport INSTANCE_NAME [--download-dir=DOWNLOAD_DIR] [--dry-run] [--force-key-file-overwrite] [--plain] [--python-path=PYTHON_PATH] [--reports-path=REPORTS_PATH; default="/tmp/gcloud-sosreport"] [--sosreport-install-path=SOSREPORT_INSTALL_PATH; default="/tmp/git-sosreport"] [--ssh-flag=SSH_FLAG] [--ssh-key-file=SSH_KEY_FILE] [--strict-host-key-checking=STRICT_HOST_KEY_CHECKING] [--user=USER] [--zone=ZONE] [--ssh-key-expiration=SSH_KEY_EXPIRATION | --ssh-key-expire-after=SSH_KEY_EXPIRE_AFTER] [GCLOUD_WIDE_FLAG ...]
(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.
To obtain relevant debug information from a VM, run:
$ gcloud alpha compute diagnose sosreport
- INSTANCE_NAME
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
- --download-dir=DOWNLOAD_DIR
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.
- --dry-run
Print the equivalent scp/ssh command that would be run to stdout, instead of executing it.
- --force-key-file-overwrite
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.
- --plain
Suppress the automatic addition of ssh(1)/scp(1) flags. This flag is useful if you want to take care of authentication yourself or use specific ssh/scp features.
- --python-path=PYTHON_PATH
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.
- --reports-path=REPORTS_PATH; default="/tmp/gcloud-sosreport"
Remote location (within the VM) to write the reports into.
- --sosreport-install-path=SOSREPORT_INSTALL_PATH; default="/tmp/git-sosreport"
Remote location (within the VM) to clone sosreport into.
- --ssh-flag=SSH_FLAG
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:162.222.181.197:80"" to ssh(1) if the external IP address of "example-instance" is 162.222.181.197.
- --ssh-key-file=SSH_KEY_FILE
The path to the SSH key file. By default, this is ~/.ssh/google_compute_engine.
- --strict-host-key-checking=STRICT_HOST_KEY_CHECKING
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_CHECKING must be one of: yes, no, ask.
- --user=USER
User for login to the selected VMs. If not specified, the default user will be used.
- --zone=ZONE
Zone of the instance to run Sosreport on. If not specified, you might be prompted to select a zone (interactive mode only). gcloud attempts to identify the appropriate zone by searching for resources in your currently active project. If the zone cannot be determined, gcloud prompts you for a selection with all available Google Cloud Platform zones.
To avoid prompting when this flag is omitted, the user can set the compute/zone property:
$ gcloud config set compute/zone ZONE
A list of zones can be fetched by running:
$ gcloud compute zones list
To unset the property, run:
$ gcloud config unset compute/zone
Alternatively, the zone can be stored in the environment variable CLOUDSDK_COMPUTE_ZONE.
- At most one of these can be specified:
- --ssh-key-expiration=SSH_KEY_EXPIRATION
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.
- --ssh-key-expire-after=SSH_KEY_EXPIRE_AFTER
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.
These flags are available to all commands: --access-token-file, --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.
Run $ gcloud help for details.
This command is currently in alpha and might change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist.