Display all available metrics in one graph

Hi there,

is ist possible to display all available metrics in one graph? My influx data source looks like this:

> select hostname,metric,service,value from foldersize ORDER BY time DESC limit 10;
name: foldersize
time			hostname	metric			service		value
----			--------	------			-------		-----
1535616267000000000	web5	/srv/backups/	foldersize	384
1535616267000000000	web5	/srv/uploads/	foldersize	737
1535616267000000000	web5	/srv/pictures/	foldersize	4
1535616267000000000	web5	/srv/archive/	foldersize	976
1535616193000000000	web5	/srv/pictures/	foldersize	4

The metrics (in this case the folder paths) depend on the host, e.g. on a different host would be different metrics. What I did so far is to query every metric in single querys like this:

SELECT mean("value") FROM "foldersize" WHERE ("hostname" = 'web5' AND "metric" = '/srv/backups/') AND $timeFilter GROUP BY time($__interval) fill(none)
SELECT mean("value") FROM "foldersize" WHERE ("hostname" = 'web5' AND "metric" = '/srv/uploads/') AND $timeFilter GROUP BY time($__interval) fill(none)

And so on for every metric…

But since the metrics are variable, I’d need grafana to get all avaiable metrics and display them in one graph. Is that possible? Thats how it should look like at the end:

Thanks!!
Philipp

Don’t use metric in condition, but use group by tag metric:

... GROUP BY time($__interval), "metric" fill(none)
1 Like

Wow thanks, works fine! :slight_smile:

How do I get the right Alias now? I tried with $metric wich didnt work. If I leave Alias empty, the legend sais:

foldersize.mean{metric: /srv/backups}
foldersize.mean{metric: /srv/archive}
...

which would be okay, but just “/srv/backups” would be better :slight_smile:

Thanks
Philipp

$tag_metric

http://docs.grafana.org/features/datasources/influxdb/

Wow, thanks a lot! :slight_smile: