

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

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

 **描述** 

 该`AWSSupport-TroubleshootPatchManagerLinux`运行手册使用中的工具 Patch Manager 对可能导致 Linux-based 托管节点补丁失败的常见问题进行故障排除。 AWS Systems Manager本运行手册的主要目标是确定补丁命令失败的根本原因并提出补救方案。

 **如何工作？** 

 `AWSSupport-TroubleshootPatchManagerLinux`运行手册会考虑您提供的情侣实例 ID/Command ID 以进行故障排除。如果未提供命令 ID，则它会在所提供的实例上选择最近 30 天内最新失败的补丁命令。检查命令状态、先决条件满足情况和操作系统分发后，运行手册会下载并运行日志分析器软件包。输出包括问题的根本原因以及修复问题所需的操作。

**文档类型**

自动化

**所有者**

Amazon

**平台**

 
+ Amazon Linux 2 和 AL2023
+ 红帽企业 Linux 8.X 和 9.X
+ Centos 8.X 和 9.X
+ SUSE 15.X

**参数**

**所需的 IAM 权限**

`AutomationAssumeRole` 参数需要执行以下操作才能成功使用运行手册。
+ `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 EC2) 或混合激活服务器）的 ID，或者手动输入 SSM 托管实例的 ID。
   + **AutomationAssumeRole （可选）：**

     输入允许 Automation 代表您执行操作的 IAM 角色的 ARN。如果未指定角色，Automation 将使用启动此运行手册的用户的权限。
   + **RunCommandId （可选）：**

     输入`AWS-RunPatchBaseline`文档的失败运行命令 ID。如果您未提供命令 ID，则运行手册将在选定实例上查找最近 30 天内最新的失败补丁命令。  
![“输入参数” 部分显示了 InstanceId 字段、 AutomationAssumeRole 下拉列表和 RunCommandId 字段。](http://docs.aws.amazon.com/zh_cn/systems-manager-automation-runbooks/latest/userguide/images/awssupport-troubleshoot-patch-manager-linux_input_parameters.png)

1. 选择执行。

1. 自动化启动。

1. 文档将执行以下步骤：
   + **CheckConcurrency:**

     确保只有一次针对同一个实例执行此运行手册。如果 runbook 发现针对同一实例的另一个执行正在进行中，则会返回错误并结束。
   + **ValidateCommand身份证:**

     验证是否已为 `AWS-RunPatchBaseline` SSM 文档执行了作为输入参数的命令 ID。如果未提供命令 ID，则运行手册将考虑选定实例在过去 30 天`AWS-RunPatchBaseline`内最近一次执行失败的情况。
   + **BranchOnCommandStatus:**

     确认所提供命令的状态为失败。否则，运行手册将结束执行并生成一份报告，说明所提供的命令已成功执行。
   + **VerifyPrerequistes:**

     确认上述先决条件已满足。
   + **GetPlatformDetails:**

     检索操作系统 (OS) 的发行版和版本。
   + **GetDownload网址：**

     检索 L PatchManager og Analyzer 软件包的下载 URL。
   + **EvaluatePatchManagerLogs:**

     在实例上下载并执行 PatchManager Log Analyzer python 软件包以评估日志文件。
   + **GenerateReport:**

     生成运行手册执行的最终报告，其中包括已发现的问题和建议的解决方案。

1. 完成后，请查看 “输出” 部分，了解执行的详细结果：  
![故障排除结果显示网络连接解决方案出现 S3 下载错误。](http://docs.aws.amazon.com/zh_cn/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/)