Sosreport 工具

您正在查看 Apigee Edge 文档。
转到 Apigee X 文档
info

Sosreport 是一种系统级诊断和数据收集工具,基于开源 软件 SoS。 您可以使用 Sosreport 工具收集信息,以帮助您调试运行 Apigee 组件的节点中的问题。该工具会在节点的本地文件系统上收集和存储信息。

Sosreport 工具会从您的系统中收集配置详细信息、系统信息和诊断信息,并将数据存储在归档中。 对于 Apigee 组件,Sosreport 会收集以下信息:

  • 正在运行的内核版本
  • 已加载的模块
  • 系统和服务配置文件

Sosreport 还会运行外部程序来收集更多信息,包括:

  • 来自所有组件的 Apigee 日志。
  • 运行时诊断
  • 使用 nodetool 命令收集的 Cassandra 诊断信息。

Sosreport 工具包含两个主要命令:

  • sosreport:用于收集数据和创建报告的主要命令。
  • apigee-sosreport:一种辅助工具,用于安装 sosreport 和管理特定于 Apigee 组件的 sosreport 插件。

安装

下表详细介绍了 Edge for Private Cloud 支持的版本中 Sosreport 工具的可用性和安装方法。

OPDK 版本 全新安装 就地升级
4.50.00.11 - 4.52.01.00 需要手动安装 需要手动安装
4.52.01.01+ 默认安装 默认安装
Amazon Linux 2023+ 不支持 不支持

在设置或更新到 Edge for Private Cloud 4.52.01.01 及更高版本时,Sosreport 工具默认安装在所有节点上。

您可以运行以下命令来验证 Sosreport 工具及其插件的安装和版本:

apigee-service apigee-sosreport version

如需列出支持 Sosreport 工具的所有插件,请使用以下命令:

sudo sosreport --list-plugins

如需仅列出特定于 Apigee 的插件,请运行以下命令:

sudo sosreport --list-plugins | grep apigee

对于 Edge for Private Cloud 4.50.00.11 到 4.52.01.00 版本,Sosreport 工具可用,但可能需要手动设置,具体取决于您的环境。

如果已安装 sosreport 的 SoS 版本

如果您的系统上已安装原始 SoS 版本的 sosreport ,请 勿设置 Apigee 的版本,因为安装路径可能会冲突。请改为使用如下所示的命令,将特定于 Apigee 的插件从目录 /opt/apigee/apigee-sosreport/source/plugin 复制到相应的 Python site-packages 目录。 例如,如需复制 apigee-mgmt.py,请执行以下操作:

  • 如果您使用的是 Python 2,请输入:
    sudo cp apigee-mgmt.py /usr/lib/python2.7/site-packages/sos/plugins/
  • 如果您使用的是 Python 3,请输入:
    sudo cp apigee-mgmt.py /usr/local/lib/python3.6/site-packages/sos/plugins/

如需验证插件是否已安装,请输入

sudo sosreport --list-plugins

如有任何疑问,请与 Apigee 支持团队联系。

以下部分介绍了如何为 4.50.00.11 到 4.52.01.00 版本安装 `sosreport`。

安装 Apigee 版本的 sosreport

如果您的系统上尚未安装 SoS 版本的 sosreport,您可以在安装了 Edge for Private Cloud 的所有节点上输入以下命令来安装 Apigee 的版本:

/opt/apigee/apigee-service/bin/apigee-service apigee-sosreport install
/opt/apigee/apigee-service/bin/apigee-service apigee-sosreport setup

如需测试 sosreport 是否已安装,请确认与 Apigee 相关的插件位于以下目录中:

/usr/lib/pythonx.x/site-packages/sos/plugins

其中,pythonx.x 是您安装的 Python 版本。

或者,您也可以运行以下命令之一:

  • 如需仅验证特定于 Apigee 的插件:
    apigee-service apigee-sosreport diagnose -l

    这会返回以下特定于 Apigee 的插件列表。

    sosreport (version 3.9)
    
    The following plugins are currently enabled:
    
    apigee-mgmt          This is the apigee plugin for edge-management-server
    apigee-mp            This is the apigee plugin for edge-message-processor
    apigee-rrt           This is the apigee plugin for edge-router
    apigee-sample        Main diagnostics gathering class
  • 如需验证所有插件:
    apigee-service apigee-sosreport diagnose -s -l

    这会返回以下可用于 sosreport 的插件列表:

    sosreport (version 3.9)
    
    The following plugins are currently enabled:
    
     acpid                ACPI daemon information
     alternatives         System alternatives
     anacron              Anacron job scheduling service
     apigee-cassandra     This is the base class for sosreport plugins. Plugins should subclass
        this and set the class variables where applicable. ←truncated→
     apigee-mgmt          This is the base class for sosreport plugins. Plugins should subclass
        this and set the class variables where applicable. ←truncated→
     apigee-mp            Main diagnostics gathering class
     apigee-rrt           This is the base class for sosreport plugins. Plugins should subclass
        this and set the class variables where applicable. ←truncated→
    
    ………………………………………………….
    ………………………………………………….
    ………………………………………………….
    ←truncated→

创建报告

Edge for Private Cloud 4.52.01.01 及更高版本

Sosreport 工具可以检测节点上的现有组件,并生成支持团队进行分析所需的所有日志的报告。

如需生成报告,请使用以下命令:

apigee-service apigee-sosreport diagnose

您可以根据需要添加以下标志:

  • -f | --file | --config:执行设置时使用的配置文件的路径。
    Example: apigee-service apigee-sosreport diagnose -f /path/to/configuration.file
  • -o | --output:将生成的 sosreport 重定向到特定目录或路径
    Example: apigee-service apigee-sosreport diagnose -o /path/to/output_directory/

Edge for Private Cloud 4.50.00.11 到 4.52.01.00 版本

如需使用 Sosreport 工具创建报告,请运行 sosreport 命令 并使用所需的插件选项(请参阅 Apigee 插件)。存储报告的默认目录为 tmp/var/tmp。 您可以通过将其他目录传递到 tmp-dir 选项来更改存储报告的目录。 例如,如需在管理服务器上创建报告并将其保存到名为 my_report-dir 的目录中,请输入以下命令之一:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf -o apigee-mgmt  --batch --tmp-dir=my_report-dir
  • 使用 SoS 版本的 sosreport:
    sudo sosreport -o apigee-mgmt  --batch --tmp-dir=my_report-dir

报告存储在您使用 tmp-dir 选项指定的目录中的 .tar.xz 文件中。 .tar.xz 文件的位置以及校验和将显示在 STDOUT 上。例如:

Your sosreport has been generated and saved in:
 /var/sosreport-prc-test-0-9613-2021-07-12-orwxufx.tar.xz
The checksum is: 5a8b97c6020346a688254c8b04ef86ec
For more available options for sosreport, read the man file:
sudo man sosreport

报告存储在您使用 tmp-dir 选项指定的目录中的 .tar.xz 文件中。 .tar.xz file 的位置以及 校验和将显示在STDOUT 上。例如:

如需了解 sosreport 的更多可用选项,请参阅 man 文件:

sudo man sosreport

Apigee 插件

以下部分介绍了以下组件的 Sosreport 工具的 Apigee 插件:

管理服务器

apigee-mgmt 插件会从管理服务器收集以下信息:

  • 服务器主机名(默认)
  • cpuinfo(默认)
  • meminfo(默认)
  • Java 虚拟机 (JVM) 设置,例如内存、 Djdk.tls.allowUnsafeServerCertChange 等(默认)
  • 当前管理日志(默认)
  • 十个连续的 top 和 jstacks 输出(默认)
  • 整个管理日志文件夹(可选)
  • config-files(可选)

示例:

如需收集所有默认项,请输入以下命令之一:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-mgmt --batch my_report-dir
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-mgmt --batch my_report-dir

如需收集所有默认项以及命令中指定的可选项,例如配置文件和所有日志,请输入以下命令之一:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-mgmt --batch -k apigee-mgmt.config-files -k apigee-mgmt.all-logs
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-mgmt --batch -k apigee-mgmt.config-files -k apigee-mgmt.all-logs

如需收集所有内容,请输入以下命令之一:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-mgmt --batch -k apigee-mgmt.config-files -k apigee-mgmt.all-logs

    或者,您也可以输入:

    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-mgmt --batch -a
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-mgmt --batch -k apigee-mgmt.config-files -k apigee-mgmt.all-logs

    或者,也可以输入:

    sudo sosreport -o apigee-mgmt --batch -a

消息处理器

apigee-mp 插件会从管理处理器 (MP) 收集以下信息:

  • 服务器主机名(默认)
  • cpuinfo(默认)
  • meminfo(默认)
  • buildinfo/版本信息(默认)
  • apigee-all 状态(默认)
  • 服务器详情(默认)
  • JVM 级设置,例如内存、Djdk.tls.allowUnsafeServerCertChange、 等(默认)
  • 当前 MP 日志(默认)
  • 十个连续的 top、jstacks 和 NIO 指标输出(默认)
  • 整个 MP 日志文件夹(可选)
  • 分类树(可选)
  • 堆转储(可选)
  • config-files(可选)
  • 运行时跟踪(可选,仅当提供 org:env:api:rev detail 时)。注意:插件会等待 25 秒来收集运行时请求。

示例:

如需收集所有默认项,请输入以下命令之一:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-mp --batch
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-mp --batch

除了所有默认项之外,您还可以指定要收集的其他可选项。 例如,如需指定堆转储,请使用标志 -k apigee-mp.heap,然后输入以下命令之一:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-mp --batch -k apigee-mp.heap
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-mp --batch -k apigee-mp.heap

同样,您可以指定以下可选项:

-k apigee-mp.deployments
-k apigee-mp.heap
-k apigee-mp.all-logs
-k apigee-mp.config-files
-k apigee-mp.trace=gsc-cps:test:httpbin:3

您可以在单个命令中指定多个选项。例如:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-mp --batch -k apigee-mp.deployments -k apigee-mp.all-logs
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-mp --batch -k apigee-mp.deployments -k apigee-mp.all-logs

如需收集除跟踪之外的所有内容,请输入以下命令之一:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-mp --batch -a
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-mp --batch -a

路由器

apigee-rrt 插件会从路由器收集以下信息:

  • 服务器主机名(默认)
  • cpuinfo(默认)
  • meminfo(默认)
  • buildinfo/版本信息(默认)
  • apigee-all 状态(默认)
  • 服务器详情(默认)
  • ps 输出。这将提供 JVM 级设置,例如, 内存、Djdk.tls.allowUnsafeServerCertChange 等(默认)。
  • 当前路由器日志(默认)
  • vhost 文件名列表,包括错误的文件名(默认)
  • 整个路由器日志文件夹(可选)
  • config-files(可选)

示例:

如需收集所有默认项,请输入以下命令之一:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-rrt --batch
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-rrt --batch

除了所有默认项之外,您还可以指定要收集的其他可选项。 例如,如需指定整个日志文件夹,请使用标志 -k apigee-rrt.all-logs,然后输入以下命令之一:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-rrt --batch -k apigee-rrt.all-logs
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-rrt --batch -k apigee-rrt.all-logs

同样,您可以指定以下可选项:

-k apigee-rrt.all-logs
-k apigee-rrt.config-files

如需收集所有内容:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-rrt --batch -a
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-rrt --batch -a

Cassandra

apigee-cassandra 插件会从 Cassandra 节点收集以下信息:

  • 机器统计信息:
    "hostname -i"
    "cat /proc/cpuinfo"
    "cat /proc/meminfo"
    "ulimit -a"
    "ps auxw"
    "df -kh"
    "du -sh"
    "netstat -ntlpu"
    "free -h"
    "ifconfig -h"
    "ps -ef"
  • Apigee 组件的状态和版本 apigee-all version && apigee-all status
  • apigee-cassandra 日志: /opt/apigee/var/log/apigee-cassandra/ 下的所有文件
  • 提交日志计数
  • 命令 Top 的输出
  • 线程转储
  • 配置文件:cassandra-topology.propertiescassandra.yamlcassandra-env.sh
  • 以下参数的 Nodetool 输出:version、status、ring、info、gossipinfo、 compactionstats -H、tpstats、netstats、cfstats、proxyhistograms

示例:

如需收集所有默认项,请输入以下命令之一:

  • 使用 Apigee 版本的 sosreport
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-cassandra
  • 使用 SoS 版本的 sosreport
    sudo sosreport -o apigee-cassandra