Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

How to graph tags values alongside fields values on timeseries graph panel? #118

Open
@fredma

Description

@fredma

Hi,

I am aware of how to add threshold in Grafana Dashboard in the viz options but I'm exploring a different way to visualize the threshold values using influxdb tags as part of the measurement. This was briefly mentionned in a session from InfluxDays 2020 that it is possible towards the end. Below is what I tried using grafana 7.1 beta with the out of the box influxdb datasource with Flux configured.

Im currently trying out sending threshold values as tags from telegraf to influxdb as below for cpu usage.

# Read metrics about cpu usage
[[inputs.cpu]]
  ## Whether to report per-cpu stats or not
  percpu = true
...

  # threshold
  [inputs.cpu.tags]
    warning = "80"
    error = "85"
    critical = "90"

Then, in grafana, the influxql query would get the tags values for those threshold tags. Grafana is able to graph those threshold tags if I drop aggregate functions from the query.

SELECT usage_user, usage_system, usage_softirq, usage_steal, usage_nice, usage_irq, usage_iowait, usage_guest, usage_guest_nice, critical, error, warning  FROM "cpu" WHERE "host" =~ /$server$/ and cpu = 'cpu-total' AND $timeFilter GROUP BY host

Below a screenshot of how it is rendered.

Screenshot 2020-07-02 at 11 59 56

Showing the same using table:

Screenshot 2020-07-02 at 12 00 40

Now, I tried to do the same with Flux, but it does not graph them as expected. I dont think we can force Grafana to tell it to graph tags values as it could be any string but in this case we are passing digits in string format.

Screenshot 2020-07-02 at 12 11 31

The query is able to get threshold tags value for sure as show below.

Screenshot 2020-07-02 at 12 12 39

I saw a transform that convert labels to fields but that only seem to work for table format. Is it not possible to have this working for graph format if the tags values are numbers?

Screenshot 2020-07-02 at 12 12 50

Finally, I was trying to use another transform "Add Field from calculation" to see if I could tell it to use tag values insteaf of field values, but the transform only expect field or hardcoded number as below. Is it possible to have it working with tags values?

Screenshot 2020-07-02 at 12 13 55

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions