Stacked graphs in Munin

Posted on Fri 01 March 2024 in Blog

Article summary: useRalativeImagePath

Given a bunch of servers being graphed in Munin, how do we combine a single graph of some value for each server into a stacked graph?

It would look like this:

Stacked load average graph

Lets do this with the load average graphs. Add the following to /etc/munin/munin.conf:

[server-loads]
update no
contacts no
loads.update no
loads.graph_args --base 1000 -l 0
loads.graph_category system
loads.graph_period minute
loads.graph_title Load averages
loads.graph_vlabel load
loads.graph_order load
loads.graph_scale no
loads.graph_total total
loads.load_stack.label Load
loads.load_stack.type DERIVE
loads.load_stack.draw AREA
loads.load_stack.min 0
loads.load_stack.stack \
    server1=research;server1.my.domain.edu:load.load \
    server2=research;server2.my.domain.edu:load.load \
    server3=research;server3.my.domain.edu:load.load \
    server4=research;server4.my.domain.edu:load.load \
    server5=research;server5.my.domain.edu:load.load

Above, loads is the graph name and load.load is the plugin name and value to be graphed separated by a period.

Note that when we run the load command we get a single value named load:

$ MUNIN_LIBDIR=/usr/share/munin/ /etc/munin/plugins/load 
load.value 0.50

Other commands would give values named different from the command name:

$ MUNIN_LIBDIR=/usr/share/munin/ /etc/munin/plugins/swap 
swap_in.value 0
swap_out.value 0

If we were to create a stacked graph of the swap_in value we would use a line like this for a server:

server1=research;server1.my.domain.edu:swap.swap_in

Related documentation: