google-cloud-platform - 当没有数据上传到 GCP 中的 BigQuery 表时创建警报

标签 google-cloud-platform google-bigquery google-cloud-logging google-cloud-monitoring

我需要在没有数据插入我的 BigQuery 表时发送电子邮件通知。为此,我正在使用日志记录和警报机制但是,我仍然无法收到任何电子邮件。以下是我遵循的步骤:

  1. 我在日志资源管理器中编写了如下查询:

enter image description here

  1. 现在我已经为那些指标类型为 COUNTER 的日志创建了一个指标,并且在过滤器部分显然我已经给出了上述查询。

  2. 现在我在 MONITORING 域下的 ALERTING 中创建了一个策略。这是随附的屏幕截图。我选择的警报策略是针对我之前创建的日志记录指标。

enter image description here

  1. 然后触发如下:

enter image description here

并在通知 channel 中添加了我的电子邮件 ID。

如果我遗漏了什么,有人可以帮助我吗?我的要求是在超过一天没有数据插入 Bigquery 表时收到警报。

而且,我可以在 Metrics Explorer 中看到,我创建的指标不是 ACTIVE。为什么会这样?

enter image description here

最佳答案

如 GCP docs 中所述:

Metric absence conditions require at least one successful measurement — one that retrieves data — within the maximum duration window after the policy was installed or modified.

For example, suppose you set the duration window in a metric-absence policy to 30 minutes. The condition isn't met if the subsystem that writes metric data has never written a data point. The subsystem needs to output at least one data point and then fail to output additional data points for 30 minutes.

意思是,您至少需要 1 个数据点(插入作业)才能为缺少的指标创建事件。

有两种选择:

  1. 创建一个人工日志条目以启动指标并至少有一个时间序列和数据点。
  2. 运行与创建的基于日志的指标相匹配的插入作业,以启动该指标。

关于您的最后一个问题,您创建的指标未激活,因为在过去 24 小时内没有任何写入数据指向它。如上所述,指标必须至少写入 1 个数据点。

引用custom metrics quota了解更多信息。

关于google-cloud-platform - 当没有数据上传到 GCP 中的 BigQuery 表时创建警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68673147/

相关文章:

google-cloud-platform - 如何在 Google Stackdriver Logging 高级查询中将字符串字段作为数字进行比较?

javascript - GCM 数据返回 null

google-cloud-platform - GKE 工作负载身份池 VS 工作负载身份联合的工作负载身份池

java - Dataproc Java 客户端抛出 NoSuchMethodError setUseJwtAccessWithScope

sql - 无法从 BigQuery 中的时间戳中提取日期

go - 如何通过 Stackdriver Logging 将错误记录到 Stackdriver Error Reporting

react-native - 尝试实现 Expo AuthSession 时出现 AuthSession 代理错误

docker - 在 Grafana 中使用 BigQuery 插件

google-bigquery - 使用 Google Data Studio 分析 Google Cloud Datastore 中的数据

google-cloud-platform - 在 stackdriver 日志记录 Web View 中仅显示某些有效负载字段