Search code examples
grafanainfluxdb

influxdb query : is it possible to return a name if a value is above a certain value?


I have influx db with a float number. when I sum an influx db query, i want to return the text as described below. Here's the query I have written:

SELECT sum("pressure") FROM "press1"

If the return value is above 50, display the word "press on". If its below display "press off"?

I cant see a way to return the text value

We are also using grafana so there may be a option in there too. The plugin we're using is imageit.

enter image description here

Thanks


Solution

  • No, InfluxDB can't return text value based on the numeric value. But you can do that in the Grafana. Some panels offer value mappings, where you can map range to text.

    For example Singlestat Math panel: Grafana Singlestat Math value mappings