我一直在尝试设置警报策略(通过堆栈驱动程序)以在云存储桶中有新对象时获取电子邮件通知。
但这里的问题是,它有时会在一段时间后起作用,而在其他大多数时候,它不会。
当桶中有新文件时(每天多次),我们如何使警报立即触发。
下面是代码:
resource "google_monitoring_alert_policy" "alert_policy" {
display_name = "File notification"
combiner = "OR"
notification_channels = ["${google_monitoring_notification_channel.email.name}"]
conditions {
display_name = "File Notification"
condition_threshold {
comparison = "COMPARISON_LT"
duration = "60s"
filter = "metric.type=\"storage.googleapis.com/storage/object_count\" resource.type=\"gcs_bucket\" resource.label.\"bucket_name\"=\"realbucketname\""
threshold_value = 1
aggregations {
alignment_period = "60s"
per_series_aligner = "ALIGN_COUNT"
}
trigger {
count = 1
}
}
}
documentation {
content = "There is a new file"
}
}
感谢您的投入!
谢谢