How do I combine series based on multiple variables in Graphana

时间:2016-02-12 21:38:22

标签: graphite grafana

On my Graphite database, I have series that look like this :

Shoutbox.shoutOutCannedMessage(list);

For example :

server.[server-name].app.[app-name].memory.used
server.[server-name].app.[app-name].memory.committed

Using Graphana, I would like to plot a single graph where I show the amount of free memory on multiple application based on template values that I may filter by server name(s) or application name(s). I also want the time series to be aliased by the server name and application name.

For example, in the example above, I'd like to see 3 series on a single graph :

server.backend.app.apiserver.memory.used
server.backend.app.apiserver.memory.committed
server.backend.app.database.memory.used
server.backend.app.database.memory.committed
server.frontend.app.webserver.memory.used
server.frontend.app.webserver.memory.committed

I'm able to do this by selecting a single server and a single application in a template using a function such as :

Series 1, free memory for backend.apiserver
Series 2, free memory for backend.database
Series 3, free memory for frontend.webserver

However, if want the graph to show multiple servers and multiple applications at once, Series B just becomes a subtraction of all the values in the A series.

An easy answer would be to send the "free" memory data explicitly to Graphite as a third data point on every application, but I was wondering if the Grafana dashboard had a function that could accomplish the same results without tampering with the existing data collection scripts I have.

1 个答案:

答案 0 :(得分:0)

取决于石墨版本,可以使用reduceSeries函数(doc具有类似示例)。

reduceSeries(
    mapSeries($server.app.$app.memory.*, 0, 2),
    "diffSeries", 4,"commited", "used"
)

说句公道话,我还没有测试过grafana的模板/可变机制。