I'm new in prometheus, need help.
I have custom metric on my 2 servers (just shows version of application):
app_version{plant="dev",env="demo"} 55.119
app_version{plant="dev",env="live"} 55.211
I want to compare this metrics and send ALERT if they are not equal trying for smth like this:
alert: Compare
expr: app_version{env="demo"} != app_version{env="live"}
for: 5s
labels:
severity: page
annotations:
summary: Compare
and this alert is green. What the right way to compare 2 metrics?
The different value for the env
label means that there's nothing to match on each side of the expression, so it returns nothing and there's no alerts. You can adjust this behaviour using ignoring
:
app_version{env="demo"} != ignoring (env) app_version{env="live"}