Munin is a small tool for monitoring resources on servers. I think it is very useful, specially on small VPS, that needs to save resources. Reports are written as HTML files, so we will need a Web Server like Apache to see this reports.
First, we install it and add some extra plugins:
$ sudo apt-get install munin munin-plugins-extra
Now, we can make some changes to the default configuration, located at /etc/munin/munin.conf. For example, we can change any of the paths where Munin works:
Specially, the htmldir path, where all the reports are written to see through Apache or the one you are using. Remember to move the directory /var/www/munin to where you wanted if you change that configuration line. We can protect this directory with an htaccess file to only give access to some users.
We can configure email notifications if a change occur (like from a OK situation to a WARNING). To do this, we just need to uncomment or add the following line:
contact.someuser.command mail -s "Munin notification" email@example.com
By default, Munin will monitor localhost, but we can add other boxes (clients), these machines will only need to install munin-node package.
Then, we can enable some plugins (more plugins can be found here and here). To do this, we need to create a symbolic link per each plugin we want to activate. I’m going to enable apache and mysql modules, but you are free to enable the modules you need:
$ cd /etc/munin/plugins
$ sudo ln -s /usr/share/munin/plugins/apache_* .
$ sudo ln -s /usr/share/munin/plugins/mysql_* .
Each time a module is enable or disable, we need to restart the service, so we can do the following:
$ sudo /etc/init.d/munin-node restart
Also, it is recommended to reassign all files on the htmldir to munin user and group by doing:
$ sudo chown munin.munin -R /var/www/munin
And then, to avoid waiting 5 minutes until munin cron runs again, we force it by:
$ sudo /usr/bin/munin-cron --force-root
Finally, as this post is not as complete as I would like, I leave some links that may help: