Thank you!
Now my query works and looks:
sum(probe_success{instance="git.company.com:443",job="blackbox_tcp_general"})
* 2 -
sum(probe_success{instance="git.company.com:22",job="blackbox_tcp_general"})
вторник, 2 июня 2020 г., 19:13:19 UTC+3 пользователь Brian Candler написал:
>
>
> https://prometheus.io/docs/prometheus/latest/querying/operators/#one-to-one-vector-matches
>
> When you do a binary operation between two instant vectors, be default
> they must have exactly the same set of labels.
>
> As long as all the other labels are the same, you can do this:
>
> probe_success{instance="192.168.0.2",job="blackbox_tcp_general"} +
> ignoring(instance)
> probe_success{instance="172.170.220.31",job="blackbox_tcp_general"}
>
> Or you can rewrite your expression to use "sum" across multiple timeseries:
>
>
> sum(probe_success{instance=~"192\.168\.0\.2|172\.170\.220\.31",job="blackbox_tcp_general})
>
> Ideally you'd using "meaningful instance labels
> <https://www.robustperception.io/controlling-the-instance-label>" so that
> you can associate these metrics naturally by a common label. e.g.
>
> {instance="server1",address="192.168.0.2"}
> {instance="server1",address="172.170.220.31"}
>
> That would allow you to do
>
> sum by (instance) (probe_success{job="blackbox_tcp_general"})
>
>
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/feee57ff-2353-4f09-aa14-2ae6e6949bc1%40googlegroups.com.