Installing munin on Debian

Anticipating problems and resource shortages on a slice can be more valuable than fixing them after they've happened. A monitoring tool like munin lets you watch your slice's resource use over time. The graphs will highlight issues before they cause downtime or bandwidth quota overages.

What you'll need

Munin's output is in html, so you will want to have a web server running to make reports available through a web browser. You can use any web server, such as apache or nginx, but for convenience the examples in this article series will assume you are running apache. It's best if you go through a tutorial series for installing apache or nginx so you understand what's being installed, but there are also barebones instructions for a default apache install in our repository if you're an experienced user and just want the web server for the purposes of accessing munin's reports.

If you want munin to send you email alerts you'll need to have a mail server running on your munin master slice that is configured to send outgoing mail messages. Slicehost has several articles that go into detail on setting up a mail server, and as with the web server, it's best if you go through a tutorial series so you get a good explanation of how to set up the mail server. If you want a quick, minimal mail server install, however, there are barebones install articles available there as well.

Munin can monitor just a single slice or it can be used to monitor several slices from one "master" slice. If you are planning on monitoring additional slices later, be sure to perform this installation on the slice you want to use as munin's master. If you are monitoring only one slice you don't have to make that decision, of course — just follow the directions in this series and don't worry about the subsequent article on installing additional nodes.

All commands assume you're running as a non-root user with sudo access.

Installing packages

To download and install the munin master package and munin node package to your master server, run the following two commands:

sudo aptitude update

sudo aptitude install munin munin-node

The first command updates the aptitude database to ensure you install the latest packages for your distribution. The second command installs the munin master and node to your slice, also configuring your system to run munin. The changes include creating a "munin" user to own munin's files, creating directories for munin's data archive and web pages, adding a cron.d entry to have munin generate graphs every five minutes, and an init script for munin-node.

With that, most of the basic work is done for you. Now you need to customize a couple settings and make one adjustment to improve security.

The munin.conf file

Open the file /etc/munin/munin.conf so you can change a couple important settings. This file will be covered in more depth in a later article on customizing munin.

Email notification (optional)

It's possible for munin to use the local mail command to send some basic email alerts if you have a mail server installed on the master server. The munin.conf file provides an example that sends an email whenever a plugin changes status (from OK to WARNING, for example, or when a warning situation is resolved):

# Drop somejuser@fnord.comm and anotheruser@blibb.comm an email everytime 
# something changes (OK -> WARNING, CRITICAL -> OK, etc)
#contact.someuser.command mail -s "Munin notification" somejuser@fnord.comm
#contact.anotheruser.command mail -s "Munin notification" anotheruser@blibb.comm

You can use that example as a template to add your own email notifications. For instance, you could add the following lines to the munin.conf file:

contact.john.command mail -s "Munin notification"
contact.marcia.command mail -s "Munin notification"

The host tree

The "host tree" section of munin.conf describes the organization of any monitored nodes on munin's overview page. This guide only covers setting up one node on the same server as the munin master, so you can leave the default address of alone. You might want to change the host tree name to something more descriptive, however. Find the following in the munin.conf file:

# a simple host tree
    use_node_name yes

You can change the "localhost.localdomain" entry to reflect your slice name, especially if you will be adding other nodes to your munin reports later. Don't use any spaces in the name, that confuses some of munin's graphing scripts. You might change the host tree to look like:

    use_node_name yes

That should do it for munin.conf.

The munin-node.conf file

The security of the default configuration can be improved by making the node (the part that actually compiles statistics) completely local so it can't accept any outside connections. There's already a directive in this file telling the munin node to reject connections from outside addresses, but it's more secure to ensure the node can't be reached by external connections to begin with. Open the /etc/munin/munin-node.conf file and look for an entry with "host *", similar to:

# Which address to bind to;
host *

To restrict the node to listen to localhost only, you should change the host entry to:

# Which address to bind to;

The munin-node service

You'll need to restart the munin node to implement the change binding it to localhost:

sudo /etc/init.d/munin-node restart


In this article you set up munin as a master and a node on your slice and configured it to display some default reports via a web server.

The next article in this series will cover determining the URL you will use to access the munin reports and checking that the reports are being updated properly.

  • -- Jered

Article Comments:

Robin commented Mon Feb 07 20:43:39 UTC 2011:

I think that the actual instructions to install plugins are missing.

You have to create symlinks from /usr/share/munin/plugins/... to /etc/munin/plugins/.

Read each plugin script file, some need additional options (which are to be written in /etc/munin/plugin-conf.d/munin-node).

Also, plugins named "some" can be given a parameter by linking it as "someparam", for example "if_eth0".

There is also a munin extra plugins package.

Note about the iostat_ios plugin: the line "my ($major, ...)" is incorrect, it needs " = _@;" at the end insteaf of just ";". See google.

Also, for apache_xyz to work, you need the libwww-perl package.

Hope it helps!

Robin commented Tue Feb 08 07:08:00 UTC 2011:

It seems I missed the article: , which is not linked from here.

Jered commented Tue Feb 08 20:29:26 UTC 2011:

Oops. Thanks for pointing that out Robin, I'll get that link added to the series properly.

Want to comment?

(not made public)


(use plain text or Markdown syntax)