So since I’ve “gone rogue” and started hosting servers with Slicehost, that means that I’m also responsible for monitoring the servers. So I tried installing Munin on Ubuntu 10.04 using apt-get. I found a bunch of instructions and they were all complicated and well plain crap. I tried the Munin instructions but those didn’t seem to work either. Eventually after a bunch of tries, I figured it out and feel pretty stupid that I went through so much for something so simple. And since I can often forget these things months later, I decided to write them down here for my own personal enjoyment (if that’s what you want to call it).
1) install apache
in order to view the reports that munin installs you’ll need to install a web server. i, like most of the universe, use apache, so that’s what i’m going to do here.
sudo apt-get install apache2
this will install apache2 and start it up for you. when you’re done go to the server and you’ll see this page:
fairly simple really. nothing major and there are tons of instructions all over the interwebs that can get you to this point.
2) install postfix
you’ll also need to install a mail server if you want Munin to email you when things go into warning mode and what not.
sudo apt-get install postfix bsd-mailx
this will install postfix and the mail command (so you can test to make sure postfix is working). as you’re installing postfix you’ll be asked to set up postfix. first you’ll be asked to choose the mail server configuration.
choose internet site which will allow you to send outgoing mail from your server. on the next screen insert the server’s web address if it is not already filled in. if you screw up you can reconfigure postfix with the following command
sudo dpkg-reconfigure postfix
once you’ve got that set up you’ll want to test to see if you can send email to an outside email address. you can do this by typing the following:
mail firstname.lastname@example.org Subject: your subject here body of the email here .
the period will end the email and send it on its way. before doing this i usually tail the mail.log located in /var/log and watch the email get sent on its way. watch out because it may end up in your spam folder rather than your inbox (just an fyi).
3) install munin munin-node
next you’ll want to install munin, which does the monitoring, and munin-node, which goes on any server that you want monitored. you can do this again with apt-get
sudo apt-get install munin munin-node
3.1) email notification
if you would like to have munin notify you when something moves from OK to another state (or back again) you’ll want to set up email notifications. you’ll need to do this by editting the /etc/munin/munin.conf file.
and insert the following lines according to the instructions in the comments
# Drop email@example.com and firstname.lastname@example.org an email everytime # something changes (OK -> WARNING, CRITICAL -> OK, etc) #contact.someuser.command mail -s "Munin notification" email@example.com #contact.anotheruser.command mail -s "Munin notification" firstname.lastname@example.org contact.yourname.command mail -s "Munin notification" email@example.com
when you’re done you’ll want to start the munin-node and restart apache (just to be safe) by running the following commands
sudo start munin-node sudo apache2ctl graceful
when you’re done go to the web address of the server and you’ll see this:
so I saw that and assumed, oh its clearly a permissions error. maybe the munin user that got created on install doesn’t have access to the web server. yeah no, i was wrong.
4) edit /etc/munin/apache.conf
so with a fresh install of munin you can only access the information from the server that does the monitoring. so you’ll want to go in and edit the apache.conf file:
sudo vi /etc/munin/apache.conf
and change the following line:
Allow from 127.0.0.1 ::1
Allow from all
you can of course allow it from only particular ip addresses, or you can set up an .htpasswd file so that the directory is locked down. however you want to do it is up to you, but you probably shouldn’t be pushing this info out the world. in either case when you’re done you’ll want to restart apache.
sudo apache2ctl graceful
When all is said and done you’ll see this:
and then of course you can click on your server and look at all the pretty charts and graphs.