[英]how to make sure stackdriver log based metrics gets 0 value instead of no data?
i'm using log based metrics on few alert policies that triggers an alert when specific errors are shown on our logs.我在少数警报策略上使用基于日志的指标,当我们的日志中显示特定错误时会触发警报。
the things is, after an incident created it never resolved as when there are no errors the metric graph shows "no data" and not just 0.事情是,在事件创建后,它永远不会解决,因为当没有错误时,指标图显示“无数据”而不仅仅是 0。
how can i update the alerts policy to show 0 instead of no data?如何更新警报策略以显示 0 而不是没有数据?
the same happens for metrics of containers.容器的指标也是如此。 when container dies the alerts does not resolved automatically (only after 7 days)
当容器死亡时,警报不会自动解决(仅在 7 天后)
fetch k8s_container
| metric 'logging.googleapis.com/user/errors'
| group_by 1m, [row_count: row_count()]
| every 1m
| group_by [], [row_count_aggregate: aggregate(row_count)]
10x 10倍
i've solved this by updating the alert policy to use sum (instead of counter) on both aggregation and the condition with "most recent value" isntead of "after a minute"我已经通过更新警报策略以在聚合和条件上使用 sum(而不是计数器)来解决这个问题,“最近值”不是“一分钟后”
this causes the alerts to fire when there is a new error but also to resolve after a minute or so.这会导致在出现新错误时触发警报,但也会在一分钟左右后解决。
10x 10倍
There is no difference between “no data” and the value “0” . “无数据”和值“0”之间没有区别。 At the end they mean that there is nothing.
最后,他们的意思是什么都没有。 Also, it seems that there is no way to change this default configuration.
此外,似乎无法更改此默认配置。
I have checked the official documentation for GCP Container and Kubernetes metrics and I wasn't able to find something useful for this case.我已经检查了GCP Container和Kubernetes 指标的官方文档,但我找不到对这种情况有用的东西。
But you can create an alert to monitor this behavior.但是您可以创建警报来监控此行为。
I have found this tutorial that can help you to create alerts for missing monitoring data with Stackdriver.我发现本教程可以帮助您使用 Stackdriver 创建丢失监控数据的警报。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.