Grafana Influx string display the first three words

34 Views Asked by At

I am currently building a Grafana dashboard for Canon printers. I would like to display the toner name. But only the toner, not the color. So the first three words. How can I do this?

Grafana currently displays the following: Canon C-EXV 49 Black Tone But I would like to have the following: Canon C-EXV 49

I have already done the following with Regex, and it works: (\S+\s+\S+\s+\S+) see screenshot from regex101.com

The InfluxDB query is:

from(bucket: "snmp_monitoring")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["host"] == "mon02.bilten.resilux.corp")
  |> filter(fn: (r) => r["agent_host"] == "$snmp_agent_host")
  |> filter(fn: (r) => r["_field"] == "SuppliesDescription_BlackToner")
  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
  |> yield(name: "last")

This is the current state in Grafana

How do I get Grafana to change the VALUE of the field?

Thank you for your help

Table view of the panel to comment @markalex

0

There are 0 best solutions below