

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# `AWSSupport-TroubleshootPatchManagerLinux`
<a name="automation-troubleshoot-patch-manager-linux"></a>

 **Description** 

 `AWSSupport-TroubleshootPatchManagerLinux` Runbook 使用 中的修補程式管理員工具，對在 Linux 型受管節點上可能導致修補程式失敗的常見問題進行故障診斷 AWS Systems Manager。此執行手冊的主要目標是識別修補程式命令失敗的根本原因，並建議修復計畫。

 **如何運作？** 

 `AWSSupport-TroubleshootPatchManagerLinux` Runbook 會考慮您提供的兩個執行個體 ID/命令 ID 進行故障診斷。如果未提供命令 ID，它會在提供的執行個體上選取過去 30 天內最新的失敗修補程式命令。檢查命令狀態、先決條件履行和作業系統分佈後，執行手冊會下載並執行日誌分析器套件。輸出包含問題根本原因，以及修正問題所需的動作。

**文件類型**

 自動化

**擁有者**

Amazon

**平台**

 
+ Amazon Linux 2 和 AL2023
+ Red Hat Enterprise Linux 8.X 和 9.X
+ Centos 8.X 和 9.X
+ SUSE 15.X

**參數**

**必要的 IAM 許可**

`AutomationAssumeRole` 參數需要下列動作才能成功使用 Runbook。
+ `ssm:SendCommand`
+ `ssm:DescribeDocument`
+ `ssm:GetCommandInvocation`
+ `ssm:ListCommands`
+ `ssm:DescribeInstanceInformation`
+ `ssm:ListCommandInvocations`
+ `ssm:GetDocument`
+ `ssm:DescribeAutomationExecutions`
+ `ssm:GetAutomationExecution`

 **指示** 

請依照下列步驟設定自動化：

1. 在 AWS Systems Manager 主控台[https://console.aws.amazon.com/systems-manager/documents/AWSSupport-TroubleshootPatchManagerLinux/description](https://console.aws.amazon.com/systems-manager/documents/AWSSupport-TroubleshootPatchManagerLinux/description)中導覽至 。

1. 選擇 Execute automation (執行自動化)。

1. 針對輸入參數，輸入下列內容：
   + **InstanceId （必要）：**

     使用互動式執行個體挑選器選擇修補程式命令失敗的 Linux 型 SSM 受管節點 (Amazon Elastic Compute Cloud (Amazon EC2) 或混合啟動伺服器） ID，或手動輸入 SSM 受管執行個體的 ID。
   + **AutomationAssumeRole （選用）：**

     輸入允許自動化代表您執行動作的 IAM 角色 ARN。如果未指定角色，自動化會使用啟動此 Runbook 之使用者的許可。
   + **RunCommandId （選用）：**

     輸入`AWS-RunPatchBaseline`文件的失敗執行命令 ID。如果您未提供命令 ID，則 Runbook 會在所選執行個體上尋找過去 30 天內的最新失敗修補程式命令。  
![\[Input parameters form for EC2 Instance Connect troubleshooting with instance ID and optional fields.\]](http://docs.aws.amazon.com/zh_tw/systems-manager-automation-runbooks/latest/userguide/images/awssupport-troubleshoot-patch-manager-linux_input_parameters.png)

1. 選取執行。

1. 自動化會啟動。

1. 文件會執行下列步驟：
   + **CheckConcurrency：**

     確保只有一個針對相同執行個體的 Runbook 執行。如果 Runbook 找到另一個以相同執行個體為目標的進行中執行，則會傳回錯誤並結束。
   + **ValidateCommandID：**

     驗證是否為 `AWS-RunPatchBaseline` SSM 文件執行提供的命令 ID 做為輸入參數。如果未提供命令 ID，則 Runbook 會考慮所選執行個體`AWS-RunPatchBaseline`上過去 30 天內 的最新失敗執行。
   + **BranchOnCommandStatus：**

     確認提供的命令的狀態失敗。否則，執行手冊會結束執行，並產生報告，指出提供的命令已成功執行。
   + **VerifyPrerequistes：**

     確認滿足上述先決條件。
   + **GetPlatformDetails：**

     擷取作業系統 (OS) 分佈和版本。
   + **GetDownloadURL：**

     擷取 PatchManager Log Analyzer 套件的下載 URL。
   + **EvaluatePatchManagerLogs：**

     下載並執行執行個體上的 PatchManager Log Analyzer python 套件，以評估日誌檔案。
   + **GenerateReport：**

     產生 Runbook 執行的最終報告，其中包含已識別的問題和建議的解決方案。

1. 完成後，請檢閱輸出區段以取得執行的詳細結果：  
![\[Troubleshooting results showing an error downloading payload and suggested solutions.\]](http://docs.aws.amazon.com/zh_tw/systems-manager-automation-runbooks/latest/userguide/images/awssupport-troubleshoot-patch-manager-linux_outputs.png)

 **參考** 

Systems Manager Automation
+ [執行此自動化 （主控台）](https://console.aws.amazon.com/systems-manager/documents/AWSSupport-TroubleshootPatchManagerLinux/description)
+ [執行自動化](https://docs.aws.amazon.com//systems-manager/latest/userguide/automation-working-executing.html)
+ [設定自動化](https://docs.aws.amazon.com//systems-manager/latest/userguide/automation-setup.html)
+ [支援自動化工作流程登陸頁面](https://aws.amazon.com/premiumsupport/technology/saw/)