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 版本

如果系統尚未安裝 sosreport 的 SoS 版本,您可以在已安裝 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
  • 使用 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 外掛程式

下列各節針對下列元件,說明 Apigee 外掛程式和 Sosreport 工具:

管理伺服器

apigee-mgmt 外掛程式會從管理伺服器收集下列資訊:

  • 伺服器主機名稱 (預設)
  • cpuinfo (預設)
  • meminfo (預設)
  • Java 虛擬機器 (JVM) 設定,例如記憶體、Djdk.tls.allowUnsafeServerCertChange 等 (預設)
  • 目前管理記錄 (預設)
  • 10 個序列頂端和 jstacks 輸出內容 (預設)
  • 整個管理記錄檔資料夾 (選用)
  • config-files (選用)

示例:

如要收集所有預設項目,請輸入下列其中一個值:

  • 使用 Apigee 的 sosreport 版本:
    sudo sosreport --config-file /opt/apigee/apigee-sosreport/conf/sos.conf  -o apigee-mgmt --batch my_report-dir
  • 使用 sosreport 的 SoS 版本:
    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
  • 使用 sosreport 的 SoS 版本:
    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
  • 使用 sosreport 的 SoS 版本:
    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 記錄 (預設)
  • 10 個序列頂端、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
  • 使用 sosreport 的 SoS 版本:
    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
  • 使用 sosreport 的 SoS 版本:
    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
  • 使用 sosreport 的 SoS 版本:
    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
  • 使用 sosreport 的 SoS 版本:
    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
  • 使用 sosreport 的 SoS 版本:
    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
  • 使用 sosreport 的 SoS 版本:
    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
  • 使用 sosreport 的 SoS 版本:
    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
  • 使用 sosreport 的 SoS 版本:
    sudo sosreport -o apigee-cassandra