vmware收集日誌相關
- 2019 年 10 月 29 日
- 筆記
VMware 中收集診斷資訊,可能包含來自 ESXi 主機和 vCenter Server 的支援包。在主機支援包中收集的數據可能被視為敏感數據。另外,從 vSphere 6.5 起,支援包中還會包含來自 ESXi 主機的加密資訊。
1、在 ESXi/ESX 主機上的控制台會話中運行 vm-support
將控制台打開到 ESX 或 ESXi 主機 運行vm-support
#vm-support --version
vm-support v2.0
生成壓縮的日誌包,並將其存儲在擴展名為.tgz的文件中,放在以下位置之一:
/var/tmp//var/log/- 當前的工作目錄
- 要將日誌包導出到共享 vmfs 數據存儲,請使用此命令:
vm-support -f -w /vmfs/volumes/DATASTORE_NAME
注意:-f選項在 ESXi 5.x、ESXi/ESX 4.1 Update 3 及更高版本中不可用。
也可將日誌包收集並下載到客戶端後,將日誌上載到 SFTP/FTP 站點。
2、通過流的方式傳輸 ESXi 5.x 和 6.0 主機中的 vm-support 輸出
啟用通過 SSH 訪問 ESXi Shell
運行以下命令
ssh root@ESXHostnameOrIPAddressvm-support -s >vm-support-Hostname.tgz
# vm-support -s >/vmfs/volumes/OCS01_SY18_CP05PV2C16/vmsupport.tgz
也可以使用同一個命令將支援日誌包定向到所需的數據存儲位置(提到目標路徑)。例如:
ssh root@ESXHostnameOrIPAddress'vm-support -s >/vmfs/volumes/datastorexxx/vm-support-Hostname.tgz'
3、從 ESXi 5.x 和 6.0 主機中基於 HTTP 下載 vm-support 輸出
從 ESXi 5.0 開始,可通過 HTTP 調用vm-support命令行實用程式。這允許使用 Web 瀏覽器或命令行工具(如wget或curl)下載內容。
- 使用任何 HTTP 客戶端,從以下位置下載資源:
https://ESXHostnameOrIPAddress/cgi-bin/vm-support.cgi例如,在 Linux 或其他 Posix 客戶端(如 vSphere Management Assistant 設備)上使用wget實用程式下載資源。將在客戶端上的以下指定位置生成壓縮日誌包:wget https://10.11.12.13/cgi-bin/vm-support.cgi - 在收集日誌包並將其下載到客戶端後,將日誌上載到 SFTP/FTP 站點。
vc中的資訊收集
使用命令行從 vCenter 5.x Server Appliance 中收集支援包
要從 vCenter 5.x Server Appliance 收集診斷資訊,請執行以下操作:
- 打開控制台會話以進入 vCenter Server Appliance。
- 以管理用戶身份(如
root)登錄。 - 運行以下命令:
/usr/sbin/vc-support.sh該命令列出要包括在支援包中的每個文件以及所生成的日誌包的路徑和文件名。日誌包在發出此命令的目錄中以當前日期命名。例如:/root/vcsupport-yyyy-mm-dd.pid.zip
使用命令行從 vCenter 6.0 或更高版本的 Server Appliance 或外部 Platform Services Controller 中收集支援包
- 打開控制台會話以進入 vCenter Server Appliance。
- 以管理用戶身份(如 root)登錄。
- 鍵入 shell.set --enabled true,然後按Enter。
- 鍵入 shell,然後按 Enter。
- 運行以下命令以將日誌導出到 /storage/log/: vc-support -l
使用 Web 瀏覽器從 vCenter 6.0 Server Appliance 或外部 Platform Services Controller 中收集支援包
- 打開 Web 瀏覽器並導航到 https://vCenter_server_FQDN:443/appliance/support-bundle
- 出現提示時,輸入 root 憑據,然後單擊Enter。
將自動開始下載為 vm-support.tgz。
使用 Web 瀏覽器從 vCenter 5.x Server Appliance 中收集支援包
- 打開 Web 瀏覽器並導航到:
https://vCenter_Server_IP_address:5480 - 使用您的憑據或以本地管理員身份登錄。
- 單擊 vCenter Server 選項卡。
- 單擊狀態選項卡。
- 單擊下載 vCenter Server 支援包鏈接。 完成後,該支援包位於 VCSA 上的以下位置:
/tmp/vc-support-bundle/
Downloading a diagnostic log bundle from vCenter Server
To download a vc-support diagnostic log bundle from vCenter Server:
- Enter the command:
Get-Log -Bundle -DestinationPath c:StorageLocationYou see output similar to:Data----C:StorageLocationvc-support-nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn.tgz - No progress bar is provided for the command. When completed, upload the logs to the FTP site. For more information, see Uploading diagnostic information to VMware (1008525).
Download a diagnostic log bundle from an ESX/ESXi host
To download a vm-support diagnostic log bundle from an ESX/ESXi host managed by vCenter Server:
- Enter the command:
Get-VMHost HostNameOrIP | Get-Log -Bundle -DestinationPath c:StorageLocationYou see output similar to:Data----C:StorageLocationvm-support-nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn.tgz - No progress bar is provided for the command. When completed, upload the logs to the FTP Site. For more information, see Uploading diagnostic information to VMware (1008525).
vc中的介面導出日誌


還有一些/var/log下的日誌,比如vmkernel.log vpxa.log hostd.log等需要關注。


