By Etel Sverdlov and Justin Ellingwood
This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:
Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.
This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.
The lines that the user needs to enter or customize will be in red in this tutorial! The rest should mostly be copy-and-pastable.
Munin is a helpful utility that provides a visual way to monitor a VPS. It is set up to be extremely plug and play. It can be installed very quickly through apt-get. We will be using Ubuntu 12.04 in this guide.
First, we will install and configure Munin on a monitoring server, and then we will add configuration options that will allow Munin to monitor a remote server.
To start off, be sure that apache2 is installed on the VPS you will use for monitoring. You can ensure that this is the case by checking the apache version number:
If it is not yet installed, you can go ahead and install it:
sudo apt-get install apache2
Munin itself can be installed through apt-get. Once has it has been downloaded, there are very few steps required to get the graphs displayed. The initial configuration will take place on the monitoring server.
Start by installing munin on the monitoring server. The munin package contains both the server components and the client components necessary to monitor the machine it is installed on. The server component can be used to monitor behavior across multiple servers, as we will be demonstrating later.
Install the server and client components with the following command:
sudo apt-get install munin
Once the package is installed, you only need to make a few changes to get your installation working.
Start off by opening the main munin configuration file:
sudo nano /etc/munin/munin.conf
There are a few lines that we have to pay particular attention to:
# dbdir /var/lib/munin # htmldir /var/cache/munin/www # logdir /var/log/munin # rundir /var/run/munin
Dbdir stores all of the rrdfiles containing the actual monitoring information, htmldir stores the images and site files, logdir maintains the logs, and rundir holds the state files. All four lines should be uncommented.
Additionally the htmldir line should be changed to point your web directory. For this guide, we will point it to /var/www/munin.
The four lines should now look like this:
dbdir /var/lib/munin htmldir /var/www/munin logdir /var/log/munin rundir /var/run/munin
Additionlly, two other lines should be changed within the configuration file. "Tmpldir" should be uncommented and the server name on the line localhost.localdomain should be updated to display the hostname, domain name, or other identifier you'd like to use for your monitoring server. We will use "MuninMonitor" in this guide:
tmpldir /etc/munin/templates [MuninMonitor] address 127.0.0.1 use_node_name yes
Save and close this file for now.
Next, you will be editing Munin's apache configuration file to point apache in the right direction when you request the monitoring information. Open Munin's apache configuration file:
sudo nano /etc/munin/apache.conf
There are a few items that need to be addressed at the top of this file. We need to change both the alias declaration and the directory path to point to the "htmldir" attribute we set in the munin.conf file.
We also need to allow connections from outside of the local computer, since you are likely accessing this cloud server remotely.
Change the beginning of this file to reflect this information:
Alias /munin /var/www/munin <Directory /var/www/munin> Order allow,deny #Allow from localhost 127.0.0.0/8 ::1 Allow from all Options None
Next, you will need to create the directory path that you referenced in the munin.conf file and modify the ownership to allow munin to write to it:
sudo mkdir /var/www/munin sudo chown munin:munin /var/www/munin
Once all of these changes are in place, you can restart apache and munin to make the changes effective.
sudo service munin-node restart sudo service apache2 restart
It might take a few minutes to generate the necessary graphs and html files. After about five minutes, your files should be created and you will be able to access your data. You should be able to access your munin details at:
If you get an error message in your browser similar to the following, you need to wait longer for munin to create the files:
Forbidden You don't have permission to access /munin/ on this VPS.
Munin can easily monitor multiple servers at once. The remainder of the article will focus on configuring a client setup that sends its data to the Munin monitoring server that we have configured. This scenario can easily scale to accommodate a number of clients.
Log into the client VPS that you want to monitor.
The remote client machine does not need all of the munin components or apache2 installed. It only requires the client tools. You can install these through apt-get with the following commands:
sudo apt-get update sudo apt-get install munin-node
Next, you need to edit the munin-node.conf file to specify that your monitoring server is allowed to poll the client for information. Open the file for editing:
sudo nano /etc/munin/munin-node.conf
Search for the section that has the line "allow ^127\.0\.0\.1$". Modify the IP address to reflect your monitoring server's IP address.
The IP entry should begin with a carat character (^), have four sets of numbers separated by a backslash and dot (\.), and end with a dollar sign ($). Below is a sample entry that you will need to change for your own setup:
Save and close the file.
Restart the munin-node service:
sudo service munin-node restart
You now need to edit the configuration files for the monitoring server again. Log into the monitoring server now.
First, edit the munin.conf file:
sudo nano /etc/munin/munin.conf
Find the host list that you modified with your monitoring server's name:
[MuninMonitor] address 127.0.0.1 use_node_name yes
Copy that section and paste it below the current entry. We will modify the name and the IP address to reflect the client server's information that we are configuring:
[MuninClient] address 111.222.333.444 use_node_name yes
Save and close the file.
Restart the apache server to reload the configuration:
sudo service apache2 restart
Once again, it will take a few minutes for the correct files to be generated and pulled from the remote client.
After a few moments, if you return to your "MonitoringServerIPAddress/munin" page, you should see an option to view your remote client machine.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi… Do kindly help me, recently i have successfully installed munin monitoring tool in my of company testing server which running with centos 7 for the network monitoring purpose. I have been encountering email configuration problem where i am not receiving email notification after done the necessary setup in vim /etc/munin/munin.conf. Refer below for more info.
a simple host tree
[selserver.testing.localhost] [localhost.localdomain] address 127.0.0.1 use_node_name yes postfix_mailvolume.volume.warning 100000 load.load.warning 1.0 load.load.critical 5.0 df._dev_sda1.warning 60
Useful information. But zoom not working. It would be great to add information how to make zoom work.
How to add windows clients in munin monitoring ubuntu based server.
I end up whit this error when i try to zoom in on the graph
You don’t have permission to access /munin-cgi/munin-cgi-graph/
What can i do about that?
Nice article. Great work.
thnx much for this awesome guide! I use munin now to monitor my servers :-)
Awesome, just used this to start monitoring my server, thank you for taking the time to write and share this guide friend!
This tutorial is a little outdated.
On latest Ubuntu, with Apache 2.4, You also need to change the “order … allow…” lines in apache.conf to “Require …”.
@Jean-Philippe: The linked nginx configuration uses “<code>root /var/www/html</code>” as the web directory. So make sure to reflect that in “<code>/etc/munin/munin.conf</code>” The “htmldir” should be “<code>/var/www/html/munin</code>”
I did the install with the nginx setup page given later, but I can’t seem to get anything. The my webfolder stays empty.
What would be the correct steps to try and resolve that?