搭配使用 DescribePatchGroupState 與 CLI - AWS Systems Manager

搭配使用 DescribePatchGroupState 與 CLI

下列程式碼範例示範如何使用 DescribePatchGroupState

CLI
AWS CLI

取得修補程式群組的狀態

下列 describe-patch-group-state 範例示範擷取修補程式群組的高階修補程式合規摘要。

aws ssm describe-patch-group-state \ --patch-group "Production"

輸出:

{ "Instances": 21, "InstancesWithCriticalNonCompliantPatches": 1, "InstancesWithFailedPatches": 2, "InstancesWithInstalledOtherPatches": 3, "InstancesWithInstalledPatches": 21, "InstancesWithInstalledPendingRebootPatches": 2, "InstancesWithInstalledRejectedPatches": 1, "InstancesWithMissingPatches": 3, "InstancesWithNotApplicablePatches": 4, "InstancesWithOtherNonCompliantPatches": 1, "InstancesWithSecurityNonCompliantPatches": 1, "InstancesWithUnreportedNotApplicablePatches": 2 }

如需詳細資訊,請參閱《AWS Systems Manager 使用者指南》中的「關於修補程式群組」<https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-patch-patchgroups.html>__ 和了解修補程式合規狀態值

PowerShell
Tools for PowerShell

範例 1:此範例示範取得修補程式群組的高階修補程式合規摘要。

Get-SSMPatchGroupState -PatchGroup "Production"

輸出:

Instances : 4 InstancesWithFailedPatches : 1 InstancesWithInstalledOtherPatches : 4 InstancesWithInstalledPatches : 3 InstancesWithMissingPatches : 0 InstancesWithNotApplicablePatches : 0

如需完整的 AWS SDK 開發人員指南和程式碼範例清單,請參閱透過 AWS SDK 使用此服務。此主題也包含有關入門的資訊和舊版 SDK 的詳細資訊。