在Prometheus中添加两个值 [英] Adding two values in Prometheus

查看:161
本文介绍了在Prometheus中添加两个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要在Prometheus中添加两个查询的结果.摘录如下:

We need to add results of two queries in Prometheus. Snippet is below:

(probe_ssl_earliest_cert_expiry{job="SSL-expiry"} - time() < 86400 * 738 )*1000 + (node_time_seconds*1000)

但结果显示没有数据,如下所示:

but the result says no data as shown below:

推荐答案

如果指标不匹配,您将得到一个空结果.原因是对于二进制运算符 vector1< op>vector2

You will get an empty result if the metrics do not match. The reason is that for binary operator vector1 <op> vector2

vector1和vector2产生由以下元素组成的向量vector1中的元素完全匹配的vector1标签集.其他元素将被删除.

vector1 and vector2 results in a vector consisting of the elements of vector1 for which there are elements in vector2 with exactly matching label sets. Other elements are dropped.

您必须至少添加 on() ignoring()

You must at least add a on() or ignoring() vector matching keyword specifying the labels (names) on which the (name and) value match. You may have to add grouping instruction if you have one to many matching.

在以下表达式中填充 ??? ,以使标签匹配:

Fill the ??? in the following expression such that label match:

(probe_ssl_earliest_cert_expiry{job="SSL-expiry"} - time() < 86400 * 738 )*1000 + ON(???) (node_time_seconds*1000)

这篇关于在Prometheus中添加两个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆