管理重複的 OpsItems - AWS Systems Manager

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

管理重複的 OpsItems

OpsCenter 可以從多個 AWS 服務 接收單一來源的多個重複 OpsItems。OpsCenter 會使用內建邏輯和可設定重複資料刪除字串的組合來避免建立重複的 OpsItems。在呼叫 CreateOpsItem API 操作時,AWS Systems Manager 會套用重複資料刪除內建邏輯。

AWS 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. 登入 AWS Management Console,並在 https://console.aws.amazon.com/events/ 開啟 Amazon EventBridge 主控台。

  2. 在導覽窗格中,選擇 Rules (規則)。

  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. 選擇 Next (下一步)

  9. 選擇 Next (下一步)

  10. 選擇 Update rule (更新規則)

使用 AWS CLI 來指定重複資料刪除字串

您可以在使用 AWS Systems Manager 主控台或 AWS CLI 手動建立新的 OpsItem 時,指定重複資料刪除字串。如需在主控台手動建立 OpsItem 時輸入重複資料刪除字串的詳細資訊,請參閱 手動建立 OpsItems。如果使用的是 AWS 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"