Munin Graph Draw Styles

| 1 Comment

Munin offers a number of options to control the appearance and style of the graphs it generates.

One is how the data is drawn on the graph.

  • LINE1, LINE2, LINE3 - various thicknesses of lines
  • AREA - a solid coloured area (below the line)
  • STACK - Lines or areas “stacked up” on top of previous lines or areas.

What the documentation doesn’t currently do is show you visually how these different options render. So we thought we’d do that.

What follows is the same day graphs for the primary network interface on a webserver. Most of the bandwidth flows out from the server to the various website visitor’s browsers. There is a much smaller amount of incoming traffic (http headers and us pushing updates to the server).

Given that any graph settings apply equally to the day, week, month and year graphs it’s worth comparing them all side by side.

Click on the images for full sized versions with the four different period views.

LINE1

network graph with LINE1

LINE2

network graph with LINE2

LINE3

network graph with LINE3

AREA and STACK

Note that using the above line graphs the out-going bandwidth never peaks about 6Mbit/second. The values are the same in the following graph, but because we’ve stacked the in & out bound data on top of each other, the SUM TOTAL is higher.

network graph with AREA and STACK

Our point? Well if you are more interested in the total bandwidth (in+out) you might find these graphs more suited to your needs.

LINE and STACK

The same stacking trick can be done with lines:

network graph with LINE and STACK

For those interested, here’s what we did to generate these graphs:

Client (being monitored)

On the machine we’re monitoring … (which in this case is Debian … your paths may differ)

Take a copy of the plugin so you have a backup:

cd /usr/share/munin/plugins/sudo 
cp if_ if_.orig

Edit the plugin and tweak it’s config output

sudo vi /usr/share/munin/plugins/if_

Adding the “.draw LINE1” lines below the “.type COUNTER” lines:

  echo 'down.type COUNTER'
+ echo 'down.draw LINE1'
..
  echo 'up.type COUNTER'
+ echo 'up.draw LINE1'

Replacing LINE1 with LINE2, LINE3 etc. as appropriate.

Note: If you are going to use STACK, the first item MUST be AREA or LINE1/2/3. You cannot have STACK as the first item (else what would it stack on to?)

Or to get the stacked graphs:

  echo 'down.label received'
  echo 'down.type COUNTER'
- echo 'down.graph no'
+ echo 'down.draw AREA'
  echo 'down.cdef down,8,*'
  echo 'up.label bps' 
  echo 'up.type COUNTER'
- echo 'up.negative down'
+ echo 'up.draw STACK'
  echo 'up.cdef up,8,*'
  case "$INTERFACE" in  ath*|wlan*|ra*)

The trick here is un-doing the magic that would otherwise put the “down” network data below the x-axis.

If you want the LINE stacked graph, just use ‘down.draw LINE2’ instead of ‘down.draw AREA’

Server (doing the monitoring)

This part is not required - just wait, and the graphs will update themselves in a few minutes (or hours, in the case of the yearly graph).

However, if you want to get the graphs updated now to reflect your changes, read on.

Note: replace $CLUSTER and $HOSTNAME in the commands below with values appropriate to your setup.

This will remove any existing graphs. It probably isn’t required, but we like to be sure old images don’t linger.

sudo rm /var/www/munin/$CLUSTER/$HOSTNAME-if_eth0-*.png

Poll the remote client/node. This ensures we pull in the new config parameters. [Aside, is it possible to override graphing settings from the server side config? Let us know!]

sudo -u munin /usr/share/munin/munin-update --nofork \
   --stdout --debug --host $HOSTNAME --service if_eth0

This regenerates the graph. The —nolazy switch should ensure we regenerate all appropriate files but the fact that we already removed the png images above means they should all get regenerated even if we omitted the —nolazy option.

Belts and braces.

sudo -u munin /usr/share/munin/munin-graph --nolazy --debug \
   --host $HOSTNAME --service if_eth0

Note that the next major revision of munin 1.3.x has additional graphing options.

As ever, if you have any suggestions or feedback feel free to post a comment below or send us an email.

1 Comment

You can override the graph options on the server. Just put lines in the munin.conf, under the specified hostname.

Something like:

[foo.com]
if_eth0.up.draw STACK

Leave a comment

About this Entry

This page contains a single entry by snork published on September 14, 2008 5:20 PM.

public git repository was the previous entry in this blog.

Smörgåsbord of links is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.