If you have had a look at the server information page on this blog you will see that I host this site on a fairly small virtual machine, because of that I find it very important to keep track of the resource utilisation on the node at all times, and what better way to do that than have a graph… In a larger environment I would probably use something like Cacti as it’s a bit more scalable, however I find munin great for X to XX nodes because it’s just so much more simple to setup and actually can create some better graphs :-).
First you just need to do the basic, so there is the munin service that will provide an interface to capture the stats on the source machine, then there is a server that will collect these stats to create a graph for web based viewing, we are just doing this on a single server so both of these will go on the same server:
apt-get install munin munin-node
So now the services are installed we are going to create a website directory, if you have something like cPanel you can do it through there just by adding a new domain or probably a subdomain such as stats.domain.com, alternatively if your like me and don’t have a control panel just go do a mkdir and then setup the configuration file. On my system I did the following, keep in mind this will probably be different on your system!
mkdir /var/www/munin cp /etc/nginx/sites-enabled/default /etc/nginx/sites-enabled/munin nano /etc/nginx/sites-enabled/munin service nginx restart
All you need to know is the directory that the files need to be placed so you can view them via a browser, for example I know in my example stats.domain.com will be using the root directory of ‘/var/www/munin/’
Next you need to edit the munin configuration file, really all we want to do here is update the export directory. Basically munin will create some static HTML and image files and place these in a directory, our server will handle actually providing these to the client. So edit the config file:
Look for the HTMLDIR variable and update it to match your web server configuration, for example my server was configured with:
Finally just restart the node and browse to your configured munin subdomain or domain, which ever way you set it up, it might take about 5min for the graphs to be displayed.