Red Hat Ansible Inside Reporting Guide


Red Hat Ansible Inside 1.3

了解红帽内部的报告

Red Hat Customer Content Services

摘要

使用报告开发有关如何使用 Red Hat Ansible 的见解。

对红帽文档提供反馈

如果您对本文档有任何改进建议,或发现错误,请通过 https://access.redhat.com 联系技术支持来创建一个请求。

第 1 章 Red Hat Ansible 内部报告

要遵守您的 Red Hat Ansible Inside 订阅要求,您必须将有关自动化使用的指标文件发送到红帽。本指南描述了收集的数据、如何实现其集合以及如何向红帽返回数据。

1.1. 关于报告指标

Ansible 额外保存有关自动化作业的高级使用数据。红帽使用此数据来确定在产品改进和新功能方面专注于工作的位置。

在自动化作业完成后,会收集指标来保存有关该作业的以下信息:

  • 自动化作业的类型、持续时间和时间。
  • 作业中使用的集合和角色的名称,以及使用它们的次数。
  • 安装、更新、失败和跳过的节点数量。
  • 作业期间发生的事件。
注意

红帽不会收集个人 Identifiable 信息(PII),如 IP 地址、位置、用户详情或操作系统规格。

以下构架图演示了如何将数据保存到 Python 应用程序之外的持久数据存储中,以便将其发送到红帽。

项目、凭据和清单源将数据传递给 Python 应用程序中的 Ansible SDK 同步库。自动化数据接收器将数据从同步库发送到持久性数据存储,后者将数据发送到报告和分析。

1.2. 关于指标文件

指标数据捆绑到 tarball 文件中。为每个作业生成一个单独的文件。您可以查看文件的内容:它们没有加密。

每个 tarball 文件都包含以下未加密的 CSV 文件:

  • jobs.csv 记录自动化作业的持续时间和状态、执行的任务数量以及受作业影响的主机数量。
  • modules.csv 记录模块名称、任务计数和持续时间。
  • collections.csv: 记录集合名称、任务计数和持续时间。
  • roles.csv 记录角色名称、任务计数和持续时间。
  • playbook_on_stats.csv 记录事件 ID 和数据。

第 2 章 指标文件位置

报告给红帽的指标是必需的。安装 Ansible SDK 时会自动启用自动化作业的日志记录指标。您无法禁用它。

每次运行自动化作业时,都会创建一个新的 tarball。您需要从存储位置提取数据,并监控目录的大小。

您可以自定义运行 playbook 的每个 Python 文件的指标存储位置,或者您可以使用默认位置。

2.1. 指标文件的默认位置

安装 Ansible SDK 时,默认指标存储位置被设置为 ~/.ansible/metrics 目录。

在自动化作业完成后,指标将写入目录中的 tarball。如果不存在,Ansible SDK 会创建该目录。

2.2. 自定义指标存储位置

您可以指定将指标文件存储在运行 playbook 的 Python 文件中的目录的路径。

您可以为每个 Python 自动化作业文件设置不同的目录路径,或者将多个作业的 tarball 存储到一个目录中。如果您没有在 Python 文件中设置路径,则其运行的作业的 tarballs 将保存在默认目录中(~/.ansible/metrics)中。

步骤

  1. 决定您文件系统中用于存储指标数据的位置。确保位置是可读可写的。如果不存在,Ansible SDK 会创建该目录。
  2. 在 Python 文件的 main () 函数中的 job_options 中,将 metrics_output_path 参数设置为要存储 tarballs 的目录。

    在以下示例中,指标文件存储在执行 pb.yml playbook 后的 /tmp/metrics 目录中:

    async def main():
        executor = AnsibleSubprocessJobExecutor()
        executor_options = AnsibleSubprocessJobOptions()
        job_options = {
            'playbook': 'pb.yml',
            # Change the default job-related data path
            'metrics_output_path': '/tmp/metrics',
        }

2.3. 查看指标文件

在自动化作业完成后,进入您指定的目录来存储数据并列出这些文件。

新完成作业的数据包含在 tarball 文件中,其名称以日期和时间开头,该文件是自动化作业运行的时间。例如,以下文件记录 2023 年 3 月 8 日 2.30AM 的执行自动化作业的数据。

$ ls

2023_03_08_02_30_24__aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa_job_data.tar.gz

要查看 tarball 中的文件,请运行 tar xvf

$ tar xvf 2023_03_08_02_30_24__aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa_job_data.tar.gz

x jobs.csv
x modules.csv
x collections.csv
x roles.csv
x playbook_on_stats.csv

以下示例显示了 jobs.csv 文件。

$ cat jobs.csv

job_id,job_type,started,finished,job_state,hosts_ok,hosts_changed,hosts_skipped,hosts_failed,hosts_unreachable,task_count,task_duration
84896567-a586-4215-a914-7503010ef281,local,2023-03-08 02:30:22.440045,2023-03-08 02:30:24.316458,,5,0,0,0,0,2,0:00:01.876413

当参数值不可用时,CSV 文件中的对应条目为空。在上面的 jobs.csv 文件中,job_state 值不可用。

第 3 章 向红帽报告数据

您的订阅合同要求您向红帽发送 .tar 文件,以进行核算。您的红帽合作伙伴代表将指示您如何向红帽发送文件。

法律通告

Copyright © 2025 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.