Adding two values in Prometheus

后端 未结 1 1110
失恋的感觉
失恋的感觉 2021-01-25 20:55

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 + (no         


        
相关标签:
1条回答
  • 2021-01-25 21:21

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

    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.

    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)
    
    0 讨论(0)
提交回复
热议问题