4.4.8. 使用 must-gather 工具

您可以使用 must-gather 工具收集有关 OADP 自定义资源的日志、指标和信息。

must-gather 数据必须附加到所有客户案例。

您可以使用以下数据收集选项运行 must-gather 工具:

  • 完全 must-gather 数据收集为安装 OADP Operator 的所有命名空间收集 Prometheus metrics、pod 日志和 Velero CR 信息。
  • 基本的 must-gather 数据收集在特定持续时间内收集 pod 日志和 Velero CR 信息,例如 1 小时或 24 小时。Prometheus 指标和重复日志不包含在内。
  • 使用超时的 must-gather 数据收集。如果有许多 Backup CR 失败,则数据收集需要很长时间。您可以通过设置超时值来提高性能。
  • Prometheus 指标数据转储下载包含 Prometheus 收集的数据的存档文件。

先决条件

  • 您必须使用具有 cluster-admin 角色的用户登录到 OpenShift Container Platform 集群。
  • 已安装 OpenShift CLI。

步骤

  1. 进入存储 must-gather 数据的目录。
  2. 为以下数据收集选项之一运行 oc adm must-gather 命令:

    • 完整的 must-gather 数据收集,包括 Prometheus 指标:

      $ oc adm must-gather --image=registry.redhat.io/oadp/oadp-mustgather-rhel8:v1.0

      数据保存为 must-gather/must-gather.tar.gz。您可以将此文件上传到红帽客户门户网站中的支持问题单中。

    • 特定持续时间内,基本 must-gather 数据收集功能不进行 Prometheus 指标:

      $ oc adm must-gather --image=registry.redhat.io/oadp/oadp-mustgather-rhel8:v1.0 \
        -- /usr/bin/gather_<time>_essential 1
      1
      以小时为单位指定时间。允许的值是 1h6h24h72hall,例如 gather_1h_essentialgather_all_essential
    • 使用超时的 must-gather 数据收集:

      $ oc adm must-gather --image=registry.redhat.io/oadp/oadp-mustgather-rhel8:v1.0 \
        -- /usr/bin/gather_with_timeout <timeout> 1
      1
      以秒为单位指定超时值。
    • Prometheus 指标数据转储:

      $ oc adm must-gather --image=registry.redhat.io/oadp/oadp-mustgather-rhel8:v1.0 \
        -- /usr/bin/gather_metrics_dump

      此操作可能需要很长时间。数据保存为 must-gather/metrics/prom_data.tar.gz

使用 Prometheus 控制台查看指标数据

您可以使用 Prometheus 控制台查看指标数据。

步骤

  1. 解压缩 prom_data.tar.gz 文件:

    $ tar -xvzf must-gather/metrics/prom_data.tar.gz
  2. 创建本地 Prometheus 实例:

    $ make prometheus-run

    命令输出 Prometheus URL。

    输出。

    Started Prometheus on http://localhost:9090

  3. 启动 Web 浏览器,再导航到 URL 以使用 Prometheus Web 控制台查看数据。
  4. 查看数据后,删除 Prometheus 实例和数据:

    $ make prometheus-cleanup