Server monitoring with Munin and Monit on CentOS 7.2

In this article, I will describe how you can monitor your CentOS 7 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 CentOS 7.2, but the configuration should apply to other distributions like RHEL and Scientific Linux as well.

1 Preliminary Note

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

2 Enable the EPEL Repository

On CentOS 7, Munin and Monit are not available in the default CentOS repositories. Fortunately, we can install them from EPEL repository. To enable the EPEL repository, we run:

yum -y install epel-release

Import the EPEL GPG-key:

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

and then run:

yum -y update

to ensure that the system is up to date and that the package list from EPEL is loaded before we start to install munin.

2 Install Apache web server

Munin requires a webserver to serve and display its statistics files. I will install the apache httpd server here:

yum install httpd

Start apache and enable it to be started automatically at boot time.

systemctl enable httpd
systemctl start httpd

4 Install and Configure Munin

To install Munin on CentOS, we do this:

yum -y install munin munin-node

Then we create the system startup links for Munin and start it:

systemctl enable munin-node
systemctl start munin-node

Next, we must edit the Munin configuration file /etc/munin/munin.conf.

nano /etc/munin/munin.conf

We want munin to use the name instead of localhost in the HTML output, therefore we replace localhost with Without the comments, the changed file looks like this:

# a simple host tree
    use_node_name yes

The munin statistics are protected with a username and password (Apache basic auth). In the next step we add a new user and password to the /etc/munin/munin-htpasswd file.

htpasswd /etc/munin/munin-htpasswd admin

The command will add a new user with the name "admin" and prompt twice for the new password.

Create a password for munin

Now wait a few minutes so that munin can produce the first statistics output, then go to in your browser, and you see the first statistics.

Munin Graph.

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

Share this page:

Suggested articles

6 Comment(s)

Add comment


By: grasomega

The line

"openssl req -new -x509 -days 365 -nodes -config ./monit.cnf -out /var/certs/monit.pem -keyout /var/certs/monit.pemopenssl"

should read: 

"openssl req -new -x509 -days 365 -nodes -config ./monit.cnf -out /var/certs/monit.pem -keyout /var/certs/monit.pem"

By: Ethel Prunehat

It is a shame that this article does not explain how to get Apache statistics in Munin.

By: Joerg

That is a wonderful HowTo which worked out fine. However, in my case, the graphics are just empty and stay empty for months. I did a web search but most help pages are not for CentOS.

Any ideas?

By: student

looke like a typo on

openssl req -new -x509 -days 365 -nodes -config ./monit.cnf -out /var/certs/monit.pem -keyout /var/certs/monit.pemopenssl

should be

openssl req -new -x509 -days 365 -nodes -config ./monit.cnf -out /var/certs/monit.pem -keyout /var/certs/monit.pem

By: Milly

I am going to try to install Munin and Monit in debian with this guide, greetings

By: Milly

When I activate SSL:

SSL ENABLE PEMFILE /var/certs/monit.pem

It does not work Https is also not activated


Used debian