This post is how to setup munin 1.4.5, one munin-server and one munin-node machine. I'm going to use two Ubuntu 11.10 (Oneiric Ocelot) EC2 instances to show you how to set this up.

Just skip to the next step if you already have your machines available. If you want to setup some new machines on EC2, follow from here...

Name Instance Type AMI ID Internal IP
munin-server Micro ami-61b28015 10.224.78.60
munin-node Micro ami-61b28015 10.234.185.182


Once those are built, you'll need to SSH into them and then change the hostnames to something more friendly. So connect to the machine you want to install munin-server on...

root@ip-10-56-65-94:~# hostname munin-server
root@ip-10-56-65-94:~# nano /etc/hostname

Delete what exists in here and replace it with 'munin-server'

root@ip-10-56-65-94:~# nano /etc/hosts

Add 'munin-server' to the end of the first line so it looks like...

127.0.0.1 localhost munin-server

Once your done, reconnect your SSH session and your terminal should change to be...

root@munin-server:~#

Go ahead and then do the same thing for your node machine, and call it 'munin-node'

We'll first update the apt database to make sure its got the latest information, then we'll install the munin server package. Not only does this give the server the ability to draw graphs for all nodes connected, but also so it can draw graphs for itself.

root@munin-server:~# apt-get update
root@munin-server:~# apt-get install munin

It'll install a lot of packages so it may take a while. Once it's done installing you'll be back on the console again and we'll now start munin-node running...

root@munin-server:~# start munin-node
munin-node start/running, process 24963

munin-server doesn't have a process that runs on the machine, instead every 5minutes through cron it will draw the graphs it needs to. Once it's drawn those graphs they can be found (by default), in /var/cache/munin/www. So we'll need a way to display that to users. For the examples sake i'm going to use nginx on the default IP and port. You'll probably want to use a hostname instead.

root@munin-server:~# apt-get install nginx
root@munin-server:~# nano /etc/nginx/sites-available/default

Edit the following line in the file...

root /usr/share/nginx/www;

So it reads...

root /var/cache/munin/www;

Then save the file and...

root@munin-server:~# /etc/init.d/nginx start
Starting nginx: nginx.

If you then visit your machines public IP you should see...

You can click through and see that munin has already started to graph itself, however the names aren't very useful. So let's change those...

root@munin-server:~# nano /etc/munin/munin.conf

Scroll down in this file and you'll eventually see...

[localhost.localdomain]
    address 127.0.0.1
    use_node_name yes

So let's change this so something more obvious, say we have a project called 'Lightning', we'd probably do something like this...

[lightning;munin-server]
    address 127.0.0.1
    use_node_name yes

Make those changes, then save the file. On the next round 5 minutes it'll regenerate all the HTML and the graphs. And you'll see...

We now have a munin-server which is producing graphs and monitoring itself. Next step is graphing another machine.

SSH into the munin-node machine, or whichever machine you wish to start graphing...

root@munin-node:~# apt-get update
root@munin-node:~# apt-get install munin-node

Once its finished installing we need to allow our munin-server access to this machines data. By default munin-node won't allow any IP other than its own to connect and retrieve data. So we'll need to allow through our munin-server.

root@munin-node:~# nano /etc/munin/munin-node.conf

Scroll down to where you see this...

allow ^127\.0\.0\.1$

And add a line beneath it for your munin-servers public IP address, for me it was...

allow ^10\.224\.78\.60$

Save and close that config file and restart munin-node as it started when we installed it...

root@munin-node:~# restart munin-node
munin-node start/running, process 26046

We now need to go back to our munin-server and tell it to graph this new machine.

root@munin-server:~# nano /etc/munin/munin.conf

Scroll down to where we had our lightning block, put this afterwards substituting your machines IP with mine...

[lightning;munin-node]
    address 10.234.185.182
    use_node_name yes

Save the file, give it 5minutes to do another drawing cycle and you'll see this...

Hooray! All done! :D