Graphite Tip - Mixing Lines and Stacks

2013-08-16 13:43:15 by jdixon

One of Graphite's shortcomings is that it's not easy to construct a composite chart of both lines and area sections. In fact, it's not possible at all unless you're willing to stack your areas. But if you are dealing with data where it makes sense to stack them, and you want to correlate that with something else as a line series, here's an example demonstrating how you can do it.

The example below contains a function you might not have seen before, averageSeriesWithWildcards(). I won't go into it in depth here, but you can find it in the Graphite documentation. Basically we just use it to streamline our expression; the end result is that it aggregates the cpu cores while breaking out the other wildcard. We then apply stacked() against the wildcard series to let Graphite know we want to stack all of these values as area sections.

                graphite.cpu-*.*.value, 1

Lastly, we add a separate target series that we wish to correlate with the aforementioned cpu metrics; in this case, the number of processes in a sleep state. The end result might not be something you'll rush out to add to your own dashboards, but I think it illustrates nicely the functions we're interested in seeing.

P.S. Yes, I realize that this graph resembles something inappropriate. Consider it a bonus.


at 2013-10-29 11:37:33, Marcin wrote in to say...


Thanks for the tip it's quite useful.

I have few questions

1) are you using special template for displaying CPU info in here ?

For example to ensure that red color is not reused in CPU display.

2) Did you notice that CPU doesn't really add to full 100 in some places ? Is it your collector ?

3) Is there a way to change order of display for example make idle last one instead of first.

Thanks !

Add a comment:




max length 4000 chars