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.
/render/?areaAlpha=0.3 &target= substr( stacked( averageSeriesWithWildcards( graphite.cpu-*.*.value, 1 ), ), 1,2) &target= substr( color( secondYAxis( graphite.processes.ps_state-sleeping.value ), "red"), 2,3)
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.