我向 AWS 支持中心提出了同样的问题。这是答案:
据我了解,Glue 爬虫不会发布 CloudWatch 指标以用于执行和您希望监控的统计信息,但是 Glue 爬虫能够将日志发布到 CloudWatch 日志组和日志流。根据这些日志事件消息,您可以创建一个指标过滤器 [1] 以匹配特定的过滤器模式,并生成您自己的指标来监控和警报。例如,如果指标过滤器检测到过滤器模式“Crawler 已完成运行并处于 READY 状态”,它将向您的自定义命名空间指标发布一个值。以下是创建指标过滤器的一些步骤:
1) Open the CloudWatch Log Groups console
2) Select the Glue crawler log group
3) Select Metric filters, choose Create metric filter
4) In Filter pattern, enter a pattern that you want to match in the log streams, ie: "Crawler has finished running and is in state READY", then choose Next
4a) You can test your filter pattern against a log stream or by manually specifying log event messages
5) Enter a filter name, enter a customer metric namespace, metric name, metric value. The metric value while be published on the metric, ie: 1, then choose Next
6) Review the metric filter configuration and choose Create metric filter
CloudWatch Events 能够根据 Glue 爬虫状态更改调用目标,例如,如果爬虫状态更改为失败,则可以调用 SNS 主题目标并向您发送电子邮件。以下是创建 CloudWatch 事件的一些步骤:
1) Open the CloudWatch Rules console
2) Choose Create rule
3) In Service Name, select Glue, in Event Type select Glue Crawler State Change
4) Choose Specific state(s) and choose Failed
5) Add a Target, for example SNS Topic, choose Configure details
6) Enter a Rule name and choose Create rule
享受你一天的剩余时间。