Adding 95th Percentile in Munin, without any patches: undocumented setting graph_args_after

Jan 28, 2014 15:51


Munin is commonly used to graph lots of systems stuff, however it lacks a common piece of functionality: 95th percentile.

The Munin bug tracker has ticket #443 sitting open for 7 years now, asking for this, and proving a not-great patch for it.

I really wanted to add 95th percentile to one of my complicated graphs (4 base variables, and 3 derived variables deep), but I didn't like the above patch either. Reading the Munin source to consider implementing VDEF properly, I noticed an undocumented setting: graph_args_after. It was introduced by ticket #1032, as a way of passing things directly to rrdtool-graph.

Clever use of this variable can pass in ANYTHING else to rrdtool-graph, including VDEF! So without further ado, here's how to put 95th percentile into individual Munin graphs, relatively easily.

# GRAPHNAME is the name of the graph you want to render on. # VARNAME is the name of the new variable to call the Percentile line. # DEF_VAR is the name of the CDEF or DEF variable from earlier in your graph definition. # LEGEND is whatever legend you want to display on the graph for the line. # FYI Normal rrdtool escaping rules apply for legend (spaces, pound, slash). ${GRAPHNAME}.graph_args_after \ VDEF:${VARNAME}=gcdef${DEF_VAR},95,PERCENT \ LINE1:${VARNAME}\#999999:${LEGEND}:dashes \ GPRINT:${VARNAME}:\%6.2lf\%s\\j
# Example of the above I'm using bandwidth1.graph_args_after \ VDEF:totalperc=gcdeftotal,95,PERCENT \ LINE1:totalperc\#999999:95th\ Percentile\ (billable\):dashes \ GPRINT:totalperc:\%6.2lf\%s\\j

percentile, linux, gentoo, munin, graphs

Previous post Next post
Up