获取审核的状态

本页介绍了如何在审计管理器中获取正在进行的审计的状态。审核是长时间运行的操作,在操作运行时获取审核状态会很有帮助。

准备工作

获取正在进行的审核的状态

控制台

  1. 在 Google Cloud 控制台中,前往审核管理器页面。

    前往“审核管理器”

  2. 合规性审核部分中,点击查看审核

  3. 查看评估页面上,您可以查看正在进行的审核的当前状态,也可以详细了解已完成的审核。

  4. 如需查看有关审核的更多信息,请点击状态列中的链接。

gcloud

gcloud audit-manager operations describe 命令用于描述审核操作。

在使用下面的命令数据之前,请先进行以下替换:

  • RESOURCE_TYPE:资源类型,可以是项目或文件夹。例如:folder
  • RESOURCE_ID:项目或文件夹的资源 ID。例如:8767234
  • LOCATION:Audit Manager API 端点的位置。如需查看可用端点的列表,请参阅位置。例如:us-central1
  • AUDIT_OPERATION_ID:运行审核时包含在响应正文中的正在进行的操作的唯一 ID。例如:098234

执行以下命令:

Linux、macOS 或 Cloud Shell

gcloud audit-manager operations describe AUDIT_OPERATION_ID \
    --RESOURCE_TYPE=RESOURCE_ID \
    --location=LOCATION

Windows (PowerShell)

gcloud audit-manager operations describe AUDIT_OPERATION_ID `
    --RESOURCE_TYPE=RESOURCE_ID `
    --location=LOCATION

Windows (cmd.exe)

gcloud audit-manager operations describe AUDIT_OPERATION_ID ^
    --RESOURCE_TYPE=RESOURCE_ID ^
    --location=LOCATION

REST

在使用任何请求数据之前,请先进行以下替换:

  • RESOURCE_TYPE:资源类型,可以是项目或文件夹。例如:folder
  • RESOURCE_ID:项目或文件夹的资源 ID。例如:8767234
  • LOCATION:Audit Manager API 端点的位置。如需查看可用端点的列表,请参阅位置。例如:us-central1
  • AUDIT_OPERATION_ID:运行审核时包含在响应正文中的正在进行的操作的唯一 ID。例如:098234

HTTP 方法和网址:

GET https://auditmanager.googleapis.com/RESOURCE_TYPE/RESOURCE_ID/locations/LOCATION//operationDetails/AUDIT_OPERATION_ID

如需发送请求,请选择以下方式之一:

curl

执行以下命令:

curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://auditmanager.googleapis.com/RESOURCE_TYPE/RESOURCE_ID/locations/LOCATION//operationDetails/AUDIT_OPERATION_ID"

PowerShell

执行以下命令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://auditmanager.googleapis.com/RESOURCE_TYPE/RESOURCE_ID/locations/LOCATION//operationDetails/AUDIT_OPERATION_ID" | Select-Object -Expand Content
成功的响应包含以下执行状态类型之一:
Status type Description
OPERATION_STATE_UNSPECIFIED An invalid state.
OPERATION_STATE_NOT_STARTED The audit report generation process has not yet started.
OPERATION_STATE_EVALUATION_IN_PROGRESS Audit Manager is evaluating the resources against compliance controls.
OPERATION_STATE_EVALUATION_DONE Audit Manager has completed compliance evaluation.
OPERATION_STATE_EVIDENCE_REPORT_GENERATION_IN_PROGRESS Audit Manager is creating an audit report from the evaluated data.
OPERATION_STATE_EVIDENCE_REPORT_GENERATION_DONE Audit Manager has completed the generation of the audit report.
OPERATION_STATE_EVIDENCE_UPLOAD_IN_PROGRESS Audit Manager is uploading the audit report and evidence to the destination.
OPERATION_STATE_DONE The audit report generation process is completed.
OPERATION_STATE_FAILED The audit report generation process has failed.

Each of the execution status types might provide any of the following additional information, when applicable:

Additional status Description
failure_reason If the audit assessment fails, this field provides the reason for the failure.
evaluation_percent_complete If evaluation has started, this field provides the percentage of the progress. When the process is yet to start, the field starts at 0. When the process is concluded, the field is set to 100.
report_generation_percent_complete If the report generation has started, this field provides percentage of the progress. When the process is yet to start, the field starts at 0. When the process is concluded, the field is set to 100.
report_uploading_percent_complete If the report uploading has started, this field provides percentage of the progress. When the process is yet to start, the field starts at 0. When the process is concluded, the field is set to 100.

当审核报告完成并上传后,系统会返回指向该报告的链接。

后续步骤