管理重复的 OpsItems - Amazon Systems Manager
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

管理重复的 OpsItems

OpsCenter 可从多个 Amazon Web Services 获得某个源的多个重复 OpsItems。OpsCenter 使用内置逻辑和可配置的重复数据删除字符串的组合来避免创建重复的 OpsItems。在调用创建OpsItem API 操作时,Amazon Systems Manager 将应用重复数据删除内置逻辑。

Amazon Systems Manager 使用以下重复数据删除逻辑:

  1. 创建 OpsItem 时,Systems Manager 会创建和存储基于重复数据删除字符串的哈希值,以及启动 OpsItem 的资源。

  2. 当发出另一个创建 OpsItem 的请求时,系统将检查新请求的重复数据删除字符串。

  3. 如果此重复数据删除字符串存在匹配的哈希值,则 Systems Manager 将检查现有 OpsItem 的状态。如果现有 OpsItem 的状态为打开或正在进行,则不会创建 OpsItem。如果现有 OpsItem 得到解决,Systems Manager 将创建一个新的 OpsItem。

创建 OpsItem 之后,您无法 编辑或更改该 OpsItem 中的重复数据删除字符串。

要管理重复的 OpsItems,可以执行以下操作:

在默认 EventBridge 规则中编辑重复数据删除字符串

按照以下过程为将 OpsCenter 作为目标的 Eventbridge 规则指定重复数据删除字符串。

为 EventBridge 规则编辑重复数据删除字符串
  1. 登录 Amazon Web Services Management Console并打开 Amazon EventBridge 控制台 (https://console.aws.amazon.com/events/)。

  2. 在导航窗格中,选择规则

  3. 选择一个规则,然后选择 Edit (编辑)

  4. 转至 Select target(s)(选择目标)页面。

  5. Additional settings(其他设置)部分,选择 Configure input transformer(配置输入转换器)。

  6. Template(模块)对话框中,找到该 "operationalData": { "/aws/dedup" JSON 条目以及您要编辑的重复数据删除字符串。

    Eventbridge 规则中的重复数据删除字符串条目使用以下 JSON 格式。

    "operationalData": { "/aws/dedup": {"type": "SearchableString","value": "{\"dedupString\":\"Words the system should use to check for duplicate OpsItems\"}"}}

    下面是一个例子。

    "operationalData": { "/aws/dedup": {"type": "SearchableString","value": "{\"dedupString\":\"SSMOpsCenter-EBS-volume-performance-issue\"}"}}
  7. 编辑这些重复数据删除字符串,然后选择确认

  8. 选择下一步

  9. 选择下一步

  10. 选择更新规则

使用 Amazon CLI 指定重复数据删除字符串

当您使用 Amazon Systems Manager 控制台或 Amazon CLI 手动创建新的 OpsItem 时,可以指定重复数据删除字符串。有关在控制台中手动创建 OpsItem 时输入重复数据删除字符串的信息,请参阅 手动创建 OpsItems。如果您使用 Amazon CLI,可为 OperationalData 参数输入重复数据删除字符串。参数语法使用 JSON,如下面的示例所示。

--operational-data '{"/aws/dedup":{"Value":"{\"dedupString\": \"Words the system should use to check for duplicate OpsItems\"}","Type":"SearchableString"}}'

此处的示例命令指定重复数据删除字符串 disk full

Linux & macOS
aws ssm create-ops-item \ --title "EC2 instance disk full" \ --description "Log clean up may have failed which caused the disk to be full" \ --priority 1 \ --source ec2 \ --operational-data '{"/aws/dedup":{"Value":"{\"dedupString\": \"disk full\"}","Type":"SearchableString"}}' \ --tags "Key=EC2,Value=ProductionServers" \ --notifications Arn="arn:aws:sns:us-west-1:12345678:TestUser"
Windows
aws ssm create-ops-item ^ --title "EC2 instance disk full" ^ --description "Log clean up may have failed which caused the disk to be full" ^ --priority 1 ^ --source EC2 ^ --operational-data={\"/aws/dedup\":{\"Value\":\"{\\"""dedupString\\""":\\"""disk full\\"""}\",\"Type\":\"SearchableString\"}} ^ --tags "Key=EC2,Value=ProductionServers" --notifications Arn="arn:aws:sns:us-west-1:12345678:TestUser"