I have two Prometheus metrics,
First PromQL
sum by (cluster) (
cnp_pg_replication_slots_active{
role="primary",
cluster="p-vpt7bgc20z"
} == 1
)
which gives me result like
{cluster="p-vpt7bgc20z"} 2
Second PromQL
sum by (cluster) (
cnp_collector_up {
role="replica",
cluster="p-vpt7bgc20z"
}
)
which also gives me result like
{cluster="p-vpt7bgc20z"} 2
Now I want to return 1 if both results are same or return 0 if any mismatch. how can I archive that?
If I write
sum by (cluster) (
cnp_pg_replication_slots_active{
role="primary",
cluster="p-vpt7bgc20z"
} == 1
) == sum by (cluster) (
cnp_collector_up {
role="replica",
cluster="p-vpt7bgc20z"
}
)
it gives me result as but I want result as boolean value 1 & 0.
{cluster="p-vpt7bgc20z"} 2