2
votes

I have 2 data series in grafana with Grahite and I want to calculate the ratio of the first_series/second_series.

However, the divideSeries(#A,#B) function accepts only a single series while I have a list of series #A and #B.

What I would like to do is divideSeries after grouping it by a particular node or wildcard.
In the graphite documentation I see a applyByNode function but the documentation is pretty unclear and it is not present in Grafana. Does anyone have a good suggestion on how to archive this, or if it is not possible?

**Further Detail About the Series **

I have a list of items by subcategory of this nature:

xx.A.cat1   
xx.A.cat2  
xx.A.cat3  
xx.A.cat4

... and so on.

and I have another list

xx.total.cat1  
xx.total.cat2  
xx.total.cat3 

... and so on.

I want to calculte a sort of average of the two corresponding series by xx.A.* / xx.total.* i.e.

xx.A.cat1/xx.total.cat1
xx.A.cat2/xx.total.cat2
1
Which version of graphite are you using? 0.9.x doesn't support applyByNode anyway. Also, can you provide an example of the series you have? Are they something like x.y.A, x.y.B, c.d.A & c.d.B where you want a set of series in your output like A = x.y.A / c.d.A & B = x.y.B / c.d.B ? - AussieDan
@AussieDan I have added mroe explaination about what I am trying to archieve - B101
Thanks, that is helpful. What version of graphite are you using? - AussieDan
@AussieDan I think it is 0.9.x, not sure exactly which one, and yes, applyByNode is not supported in it. - B101

1 Answers

2
votes

With Graphite 0.9.x the only option I'm aware of would be to use the repeat panel option in Grafana to create a separate graph for each series. That will give you the data you're looking for, but with each category on a separate graph.

To do that you'd create a template variable $category use the Query type and enter xx.A.* as the query string, enabling the 'Include all option' checkbox.

Then you can create a graph panel with a query like divideSeries(xx.A.$category, xx.total.$category) and on the General tab under Templating select category for the Repeat Panel option. You'll also want to set the Title to $category.

Save the dashboard and refresh, and you'll have a graph panel for each category showing the values you're looking for.