Fix Redis missing master query

The previous approach fails because of the "missing data" semantics in Prometheus. If the Redis server is down, PromQL will typically return "no data" instead of 0 for a `count()`; this is by design in Prometheus.

This suggestion as given by @slovdahl works around this by returning an vector with a single `0` entry in this case, making the query work as intended.
This commit is contained in:
Per Lundberg 2020-11-25 16:06:05 +02:00 committed by GitHub
parent 2186841f29
commit 00dd58eace
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -520,7 +520,7 @@ groups:
severity: critical
- name: Redis missing master
description: Redis cluster has no node marked as master.
query: 'count(redis_instance_info{role="master"}) == 0'
query: 'count(redis_instance_info{role="master"}) or vector(0) < 1'
severity: critical
- name: Redis too many masters
description: Redis cluster has too many nodes marked as master.