为 Ops Agent 监控和日志记录创建实例

Ops Agent 会收集实例的遥测数据,供您之后用于问题排查和性能调整。

准备工作

  • 如果您尚未设置身份验证,请进行设置。身份验证是通过其进行身份验证以访问 Trusted Cloud by S3NS 服务和 API 的过程。如需从本地开发环境运行代码或示例,您可以通过选择以下选项之一向 Compute Engine 进行身份验证:

    Select the tab for how you plan to use the samples on this page:

    Console

    When you use the Trusted Cloud console to access Trusted Cloud by S3NS services and APIs, you don't need to set up authentication.

    gcloud

    1. After installing the Google Cloud CLI, sign in to the gcloud CLI with your federated identity and then initialize it by running the following command:

      gcloud init
    2. Set a default region and zone.
    3. REST

      如需在本地开发环境中使用本页面上的 REST API 示例,请使用您提供给 gcloud CLI 的凭据。

        After installing the Google Cloud CLI, sign in to the gcloud CLI with your federated identity and then initialize it by running the following command:

        gcloud init

      如需了解详情,请参阅 Trusted Cloud 身份验证文档中的使用 REST 时进行身份验证

所需的角色

如需获得为 Ops Agent 监控和日志记录创建实例所需的权限,请让管理员向您授予项目的以下 IAM 角色:

如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限

您也可以通过自定义角色或其他预定义角色来获取所需的权限。

在实例上安装 Ops Agent

您只能在现有实例上安装 Ops Agent。如需在单个实例或实例舰队上安装 Ops Agent,您可以使用Trusted Cloud 控制台、gcloud CLI 或自动化工具。如需查看相关说明,请参阅安装 Ops Agent

后续步骤