此问题的通常解决方案是推送测量的Unix时间戳记,并有一条规则警告它是否太旧或使用 UNLESS time()-timestamp_metric 条件.I'm using prometheus + grafana for collecting and displaying metrics. If one of my devices stops reporting grafana will continue to graph the last value. For example, if one of my devices reported its temperature 2 days ago and the temperature was 50 degrees, grafana will display a flat line for 50 degrees for the last 2 days. I would expect this timeseries graph to dip down to zero if the device wasn't reporting any metrics. Is this just the way prometheus and grafana behave or am I missing something in the configuration? I would like this timeseries graph to chart zeros if a device is not reporting rather than showing a flat line of its last value. Additional info: Using prometheus.net to push metrics to prometheus' push gateway. I've tried using the Null value: null as zero option under the Stacking and Null Value section of the graph in grafana. 解决方案 This is the expected behavior of push gateway. Once a value is pushed, it will stay forever. This is assumed by the dev team and TTL or expiration of metrics have been refusedThe usual solution to this problem is to push a Unix timestamp of the measurement and have a rule alerting if it becomes too old or use a UNLESS time() - timestamp_metric condition. 这篇关于如何在Prometheus + grafana中显示零而不是最后一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-17 00:23