How to query for "all but one" in graphite/grafana

26,149

Solution 1

Sounds like you want to filter a seriesList, you an do that inclusively using the 'grep' function or exclusively using the 'exclude' function

exclude(apps.machine*.someMetric,"machine1")

and pass that into averageSeries

averageSeries(exclude(apps.machine*.someMetric,"machine1"))

You can read more about those functions here: http://graphite.readthedocs.io/en/latest/functions.html#graphite.render.functions.exclude

Solution 2

After reading the Graphite URL API docs section about wildcard paths I don't think there is any "all but one" target query. However if you don't have many machines you can list all them but the excluded one in your query:

apps.machine1.someMetric
averageSeries(apps.{machine2,machine3,machine4,machine5}.someMetric)

Or use a character range:

apps.machine1.someMetric
averageSeries(apps.machine[2-5].someMetric)
Share:
26,149

Related videos on Youtube

Surya Subenthiran
Author by

Surya Subenthiran

Updated on May 07, 2020

Comments

  • Surya Subenthiran
    Surya Subenthiran about 4 years

    I'm playing with grafana and I want to create a panel where I compare data from one app server against the average of all the others except that one. Something like:

    apps.machine1.someMetric
    averageSeries(apps.*.not(machine1).someMetric)
    

    Can that be done? How?

  • r02
    r02 over 5 years
    This should be the accepted answer, as it filters out whatever it is you do not want to include. Got my vote :)
  • Gary
    Gary over 3 years
    I didn't see a reference to what type of regex you can use in the pattern argument to exclude, but to exclude multiple terms you can use something like: exclude(seriesList, "first|second")