2

I have a defined variable service which can be either redis-db or other-stuff in my Grafana Dashboard.

I wish to do:

if $service =~ ".*redis.*":
  promql-query1
else
  promql-query2

What I've achieved, based on this post, is

sum(kube_statefulset_status_replicas_ready{statefulset=~".*redis.*", namespace="$namespace"}) and on() (vector(1) > vector(0)) or on() sum(kube_deployment_status_replicas_available{deployment=~".*$service.*",pod_template_hash="",namespace="$namespace"})

It works but I wish to change the (vector(1) > vector(0)) for ($service =~ ".*redis.*"), so when variable redis is selected, the panel's query is the first one.

RicHincapie
  • 3,275
  • 1
  • 18
  • 30

0 Answers0