Show Gauge percentage based on conditions

  • What Grafana version and what operating system are you using?
    v6.5 and Windows 10

  • What are you trying to achieve?
    I have a gauge which should show Healthy (100%) when some condition say A and B are true, Partial Healthy (50%) when some condition C and D are true else 0%

For Ex. -
sum by (field1, field2)(metric1{field1="$field1",field2="$field2"}) == 0 OR sum by (field1, field2)(metric2{field1="$field1",field2="$field2"}) then Gauge → 100%

sum by (field1, field2)(metric3{field1="$field1",field2="$field2"}) == 0 OR sum by (field1, field2)(metric4{field1="$field1",field2="$field2"}) then Gauge → 50%

  • How are you trying to achieve it?
    I am not sure how this can be achieved. With PromQL query, can we show some values based on when some condition is true?

  • What happened?

  • What did you expect to happen?

  • Can you copy/paste the configuration(s) that you are having problems with?

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?

Can you screenshot you data in the table panel? Or share the raw query request and response? You can find it in the inspect drawer in the panel dropdown.

You should be able to accomplish this using value mappings:

This topic was automatically closed after 365 days. New replies are no longer allowed.