本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 CloudWatch 日志对警报管理器进行故障排除
使用 使用日志监控亚马逊托管服务的 Prometheus 事件 CloudWatch ,您可以对警报管理器和规则器相关问题进行故障排除。本部分包含与警报管理器相关的故障排除主题。
活动警报警告
当日志包含以下警告时
{ "workspaceId": "ws-efdc5b42-b051-11ec-b123-4567ac120002", "message": { "log": "too many alerts, limit: 1000", "level": "WARN" }, "component": "alertmanager" }
这意味着已超过警报管理器的活动警报配额。
要采取的操作
请求提高限额。登录 AWS Management Console 并打开 Service Quotas 控制台,网址为https://console.aws.amazon.com/servicequotas/
警报聚合组大小警告
当日志包含以下警告时
{ "workspaceId": "ws-efdc5b42-b051-11ec-b123-4567ac120002", "message": { "log": "Too many aggregation groups, cannot create new group for alert, groups=1000, limit=1000, alert=sample-alert", "level": "WARN" }, "component": "alertmanager" }
这意味着已超过警报管理器警报聚合组大小配额。
要采取的操作
使用group_by
参数减小警报聚合组的大小。有关更多信息,请参阅 Prometheus 文档中的路由相关设置
您也可以请求提高限额。登录 AWS Management Console 并打开 Service Quotas 控制台,网址为https://console.aws.amazon.com/servicequotas/
警报大小太大警告
当日志包含以下警告时
{ "workspaceId": "ws-efdc5b42-b051-11ec-b123-4567ac120002", "message": { "log": "alerts too big, total size limit: 20000000 bytes", "level": "WARN" }, "component": "alertmanager" }
这意味着警报管理器已超出每个工作空间的警报大小配额。
要采取的操作
删除不必要的注释和标签以缩小警报的大小。
空内容警告
当日志包含以下警告时
{ "workspaceId": "ws-abcd1234-ef56-78ab-cd90-1234abcd0000", "message": { "log": "Message has been modified because the content was empty." "level": "WARN" }, "component": "alertmanager" }
这表示警报管理器模板已将出站警报解析为空消息。
要采取的操作
验证您的警报管理器模板并确保所有接收方路径都有一个有效的模板。
key/value
警告无效
当日志包含以下警告时
{ "workspaceId": "ws-abcd1234-ef56-78ab-cd90-1234abcd0000", "message": { "log": "MessageAttributes has been removed because of invalid key/value, numberOfRemovedAttributes=1" "level": "WARN" }, "component": "alertmanager" }
这意味着某些消息属性因无效而 keys/values 被删除。
要采取的操作
重新评估您用来填充消息属性的模板,并确保其解析为有效的 SNS 消息属性。有关验证 Amazon SNS 主题的更多信息,请参阅验证 SNS 主题
消息限制警告
当日志包含以下警告时
{ "workspaceId": "ws-abcd1234-ef56-78ab-cd90-1234abcd0000", "message": { "log": "Message has been truncated because it exceeds size limit, originSize=266K, truncatedSize=12K" "level": "WARN" }, "component": "alertmanager" }
这表示有些消息大小太大。
要采取的操作
查看警报接收方消息模板,然后对其进行修改以满足大小限制。
没有基于资源的策略错误
当日志包含以下错误时
{ "workspaceId": "ws-abcd1234-ef56-78ab-cd90-1234abcd0000", "message": { "log": "Notify for alerts failed, AMP is not authorized to perform: SNS:Publish on resource: arn:aws:sns:us-west-2:12345:testSnsReceiver because no resource-based policy allows the SNS:Publish action" "level": "ERROR" }, "component": "alertmanager" }
这表示 Amazon Managed Service for Prometheus 无权向指定的 SNS 主题提交警报。
要采取的操作
验证 Amazon SNS 主题访问策略是否授权 Amazon Managed Service for Prometheus 向该主题发送 SNS 消息。创建 SNS 访问策略,授予服务 aps.amazonaws.com
(Amazon Managed Service for Prometheus)访问 Amazon SNS 主题的权限。有关 SNS 访问策略的更多信息,请参阅《Amazon Simple Notification Service 开发人员指南》中的使用访问策略语言和 Amazon SNS 访问控制示例案例。
非 ASCII 警告
当日志包含以下警告时
{ "workspaceId": "ws-abcd1234-ef56-78ab-cd90-1234abcd0000", "message": { "log": "Subject has been modified because it contains control or non-ASCII characters." "level": "WARN" }, "component": "alertmanager" }
这表示主题包含非 ASCII 字符。
要采取的操作
删除模板主题字段中对可能包含非 ASCII 字符的标签的引用。
未授权调用 KMS
当日志包含以下 AWS KMS 错误时
{ "workspaceId": "ws-abcd1234-ef56-78ab-cd90-1234abcd0000", "message": { "log": "Notify for alerts failed, AMP is not authorized to call KMS", "level": "ERROR" }, "component": "alertmanager" }
要采取的操作
验证用于加密 Amazon SNS 主题的密钥的密钥政策是否支持 Amazon Managed Service for Prometheus 服务主体 aps.amazonaws.com
执行以下操作:kms:GenerateDataKey*
和 kms:Decrypt
。有关更多信息,请参阅 SNS 主题的AWS
KMS 权限。
模板错误
当日志包含以下错误时
{ "workspaceId": "ws-efdc5b42-b051-11ec-b123-4567ac120002", "message": { "log": "Notify for alerts failed. There is an error in a receiver that is using templates in the AlertManager definition. Make sure that the syntax is correct and only template functions and variables that exist are used in the receiver 'default', sns_configs position #2, section 'attributes'" "level": "ERROR" }, "component": "alertmanager" }
这意味着 AlertManager 定义中使用的模板存在错误。错误条目包含有关接收器、sns_configs 中的位置以及包含错误的属性的说明。
要采取的操作
验证您的警报管理器定义。确保语法正确,并且引用了存在的模板变量和函数。有关更多信息,请参阅 Prometheus 开源文档中的通知模板参考