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

sprugman picture sprugman · Dec 11, 2015 · Viewed 20.9k times · Source

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?

Answer

Scott picture Scott · May 6, 2016

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