0

触发 AWS cloudwatch 复合警报时收到的 SNS 通知消息如下

{'message':'{"AlarmName":"TestCloudwatchAlarmComposite","AlarmDescription":"","AWSAccountId":"","NewStateValue":"ALARM","NewStateReason":"arn:aws:cloudwatch:region:accountId:alarm:FreeStorage transitioned to ALARM at Thursday 08 July, 2021 16:08:51 UTC","StateChangeTime":"2021-07-08T16:08:51.378+0000","Region":"US West (Oregon)","AlarmArn":"arn:aws:cloudwatch:region:accountId:alarm:TestCloudwatchAlarmComposite","OldStateValue":"OK","AlarmRule":"ALARM("MasterJVMMemoryPressureESInt") OR \\nALARM("MasterCPUUtilizationESInt") OR \\nALARM("JVMMemoryPressureESInt") OR \\nALARM("CPUUtilizationESInt") OR \\nALARM("AutomatedSnapshotFailureAlarmInt") OR \\nALARM("FreeStorage") OR \\nALARM("NodesCount") OR \\nALARM("YellowClusterInt") OR \\nALARM("RedClusterInt")","TriggeringChildren":[{"Arn":"arn:aws:cloudwatch:region:accountId:alarm:FreeStorage","State":{"Value":"ALARM","Timestamp":"2021-07-08T16:08:51.378+0000"}}]}

这里的问题是messagekey 不是 JSON 字符串,因为嵌套AlarmRulekey 的值有多个". 因此,通知消息在发送给 slack 或团队之前无法正确格式化。

我想确认是否有任何其他开发人员遇到过这个问题,如果有,可能的解决方法是什么。

4

0 回答 0