我正在我们的 AWS ElasticSearch 集群上设置一个触发器,以显示哪些 lambdas 正在生成错误。
现在我有下面的触发器代码:
Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.
- Trigger: {{ctx.trigger.name}}
- Severity: {{ctx.trigger.severity}}
- Lambda Impacted
{{#ctx.results.0.hits.hits}}
- {{_source.LambdaName}}
{{/ctx.results.0.hits.hits}}
- Count: {{ctx.results.0.hits.total}}
- Period start: {{ctx.periodStart}}
- Period end: {{ctx.periodEnd}}
现在代码按预期工作(见下文)。
Monitor errors just entered alert status. Please investigate the issue.
- Trigger: lambda-alert
- Severity: 1
- Lambda Impacted
- abc-LambdaName1
- abc-LambdaName1
- abc-LambdaName1
- abc-LambdaName1
- abc-LambdaName1
- abc-LambdaName1
- Count: 25194
- Period start: 2021-04-21T14:55:51.305Z
- Period end: 2021-04-21T15:00:51.305Z
Mustache 是否可以在输出中对这些 lambda 进行分组,以便它表示 lambda 名称以及与该 lambda 相关联的错误数(见下面的示例),以防我们有多个 lambda 发出警报并通过警报阈值。
Monitor errors just entered alert status. Please investigate the issue.
- Trigger: lambda-alert
- Severity: 1
- Lambda Impacted
- abc-LambdaName1 (6)
- abc-LambdaName2 (5)
- Count: 11
- Period start: 2021-04-21T14:55:51.305Z
- Period end: 2021-04-21T15:00:51.305Z