There is a new version of this tutorial available for Debian 8 (Jessie).

Server Monitoring With munin And monit On Debian Lenny

Version 1.0
Author: Falko Timme
Follow me on Twitter

In this article I will describe how you can monitor your Debian Lenny server with munin and monit. munin produces nifty little graphics about nearly every aspect of your server (load average, memory usage, CPU usage, MySQL throughput, eth0 traffic, etc.) without much configuration, whereas monit checks the availability of services like Apache, MySQL, Postfix and takes the appropriate action such as a restart if it finds a service is not behaving as expected. The combination of the two gives you full monitoring: graphics that lets you recognize current or upcoming problems (like "We need a bigger server soon, our load average is increasing rapidly."), and a watchdog that ensures the availability of the monitored services.

Although munin lets you monitor more than one server, we will only discuss the monitoring of the system where it is installed here.

This tutorial was written for Debian Lenny, but the configuration should apply to other distributions with little changes as well.

I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!


1 Preliminary Note

Our system's hostname is, and we have a web site on it with the document root /var/www/


2 Install And Configure munin

To install munin on Debian Lenny, we do this:

aptitude install munin munin-node

Next, we must edit the munin configuration file /etc/munin/munin.conf. We want munin to put its output into the directory /var/www/, therefore we change the value of htmldir, and we want it to use the name instead of localhost.localdomain in the HTML output, therefore we replace localhost.localdomain with Without the comments, the changed file looks like this:

vi /etc/munin/munin.conf
dbdir   /var/lib/munin
htmldir /var/www/
logdir  /var/log/munin
rundir  /var/run/munin

tmpldir /etc/munin/templates

    use_node_name yes

Next we create the directory /var/www/ and change its ownership to the user and group munin, otherwise munin cannot place its output in that directory. Then we restart munin:

mkdir -p /var/www/
chown munin:munin /var/www/
/etc/init.d/munin-node restart

Now wait a few minutes so that munin can produce its first output, and then go to in your browser, and you see the first statistics. After a few days this could look like this:

(This is just a small excerpt of the many graphics that munin produces...)


3 Password-Protect The munin Output Directory (Optional)

Now it is a good idea to password-protect the directory /var/www/ unless you want everybody to be able to see every little statistic about your server.

To do this, we create an .htaccess file in /var/www/

vi /var/www/
AuthType Basic
AuthName "Members Only"
AuthUserFile /var/www/
<limit GET PUT POST>
require valid-user

Then we must create the password file /var/www/ We want to log in with the username admin, so we do this:

htpasswd -c /var/www/ admin

Enter a password for admin, and you're done!

Share this page:

Suggested articles

11 Comment(s)

Add comment


By: Andrei V. Toutoukine

munin @ Debian/lenny

Symptoms:  no pictures on http://www.example.con/monitoring after /etc/init.d/munin-node restart

Specify a hostname in /etc/munin/munin.node.conf:


Restart munin again.


It would be any problem to use this guide with ispconfig 3?  I like various graphical monitoring tools ... :-)


Hi Nikola

I used this howto on ISPConfig3 Yesterday on a debian setup having install ISPConfig3 using the perfect server guide. It all worked well with just a couple of points to note.

When I added the site to be used for munin through the control panel it hadn't added www in front of the domain name so I needed to remove that throughout;





Then on the second page setting up monit, you'll have to comment out the lines regarding proftpd as ISPConfig3 uses pureftpd. If you don't monit will not start.

 Hope this helps



By: Marlos

Hi guys,

now I using for server performance monitoring and Alerts and i'm happy. is FREE web-service for monitoring group of servers online, with online show performance graphs. is ready for Cloud servers, Debian Servers and Ubuntu servers.

By: Anonymous

unfortunately giving away login for a monitoring service will not be accepted by most security aware linux admins. why not publish your root login at facebook and ask your "friends" to monitor your server 

however, one more really interesting target. 

By: Anonymous

Suggest you don't know what  "free" means.


By: shivlu jain

The post is wonderful. Have you written a article for NMS in linux. If yes, please the same.


 shivlu jain

By: Klevo


By: Ben

Why not use Cacti as an alternative ... it's much easier to set up (apt-get install cacti) and is managed through a web interface rather than editing conf files ... it has a massive community and a plugin architecture to make it monitor any device you want and configure alerts etc ...

By: Gunnar

I strongly prefer Munin. First, it is way more versatile, it is very easy to create new plugins for it - As an example of all the things that can be graphed with a ~20 line script, take a look at DebConf's monitoring, i.e. the totals for our attendee database's requirements. Second, while Cacti is very strong on finding your network's topology and creating the needed graphs, it is IMO a bit more lacking for host-oriented graphs. Also, monitoring can involve some actions which require running with high privileges. It just is way safer to have all of your configuration in a root-controlled directory, not database-stored and modifiable through the Web interface.

By: Tobias B.

Hi, as the attributes of /var/www/ directory changed to be not writable, the .htpasswd File must be created in /var/www/ So: vi /var/www/ AuthUserFile /var/www/ should be: AuthUserFile /var/www/ and htpasswd -c /var/www/ admin should be htpasswd -c /var/www/ admin