Sosreport 工具

您正在查看的是 Apigee Edge 文档。
转到 Apigee X 文档
信息

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

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

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

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

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

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

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

安装

本部分将介绍如何安装 sosreport

如果已安装“sosreport”的 SoS 版本

如果您的系统中已安装原始 SoS 版本的 sosreport,请不要设置 Apigee 的版本,因为安装路径可能会发生冲突。请改为使用如下所示的命令,将 Apigee 专属插件从目录 /opt/apigee/apigee-sosreport/source/plugin 复制到相应的 Python site-packages 目录。 例如,如需复制 agigee-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 支持团队联系。

安装 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 gatehring 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→

创建报告

如需使用 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 文件中。STDOUT 会显示 .tar.xz 文件的位置以及校验和。例如:

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 等(默认)
  • 当前管理日志(默认)
  • 10 个按顺序 Top-jstack 输出(默认)
  • 整个管理日志文件夹(可选)
  • 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、jstack 和 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 版本 && apigee-all 状态
  • apigee-cassandra 日志:/opt/apigee/var/log/apigee-cassandra/ 下的所有文件
  • 提交日志数
  • 命令的输出(顶部)
  • 线程转储
  • 配置文件: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