Legend table display with a Transform option - Blocked for adding an alert

  • What Grafana version and what operating system are you using?
    I’m using Grafana v8.0.5 with Debian with InfluxDB 2 and Flux …

  • What are you trying to achieve?
    I would like to get a better legend table display and be able to add Alerts.
    I’m monitoring several servers with Telegraf, when I display the legend table of my chart, I would like to get less information in the field name. For example I have the host shown but I would like to get only the metric name.

I manage to do it if I add a Transform “Labels to fields”, but in this case I can’t add any Alert and I need it.

  • How are you trying to achieve it?
    I added a Transform “Labels to Fields” but this locks the Alert system and I need it.

  • What happened?
    I can’t add Alert

  • What did you expect to happen?
    I would like to get a legend table with only the metric name and be able to add some Alerts

  • Can you copy/paste the configuration(s) that you are having problems with?
    Here is my Flux request :

from(bucket: v.defaultBucket)
  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)
  |> filter(fn: (r) => r["host"] == "${host}")
  |> filter(fn: (r) => r["_measurement"] == "cpu")
  |> filter(fn: (r) => r["_field"] == "usage_guest" or r["_field"] == "usage_iowait" or r["_field"] == "usage_irq" or r["_field"] == "usage_nice" or r["_field"] == "usage_softirq" or r["_field"] == "usage_system" or r["_field"] == "usage_user" or r["_field"] == "usage_steal")
  |> filter(fn: (r) => r["cpu"] == "cpu-total")
  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)
  |> yield(name: "mean")
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No error in logs

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

Hi @sgrasset1 and welcome to the forum.

I don’t know what the status of using aliases is with Flux like one could with do with the legacy InfluxQL query editor in Grafana. There’s probably a better way to handle this but: Grafana 8.2.0 is in beta rn and ships with regex-based value mapping. At the very least you could probably use it to strip away everything inside the curly braces. What does this data look like in table format?

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