Server Monitoring with Munin on Debian 7 (Wheezy) with Nginx

Server Monitoring with Munin on Debian 7 (Wheezy) with Nginx joan dc., 21/09/2016 - 17:52

You have a server running a Debian 8 and Nginx, and now you want to install Munin to monitorize it... Here you are steps to achieve it.

Ensure that the system is up to date before you start to install Munin, run:

apt-get update
apt-get upgrade

Install Munin:

apt-get install munin munin-node munin-plugins-extra

Création d’un lien symbolique pour la partie serveur web

 

ln -s /var/cache/munin/www /var/www/munin

 

When the server is running MySQL or MariaDB, intall this dependency

apt-get install libcache-cache-perl

then enable the a few extra Munin plugins to monitor MySQL:

cd /etc/munin/plugins
ln -s /usr/share/munin/plugins/mysql_ mysql_
ln -s /usr/share/munin/plugins/mysql_bytes mysql_bytes
ln -s /usr/share/munin/plugins/mysql_innodb mysql_innodb
ln -s /usr/share/munin/plugins/mysql_isam_space_ mysql_isam_space_
ln -s /usr/share/munin/plugins/mysql_queries mysql_queries
ln -s /usr/share/munin/plugins/mysql_slowqueries mysql_slowqueries
ln -s /usr/share/munin/plugins/mysql_threads mysql_threads

We protect munin access with a password:

htpasswd -c /etc/munin/munin-htpasswd admin

Now we should create an nginx site conf file:

 

nano /etc/nginx/conf.d/munin.conf

with a content like this, if you want to access it at yourdomain.tld/munin URL:

 

server {
        listen 80;
        server_name yourdomain.tld;
        access_log /var/log/nginx/acces_munin.log;
        error_log /var/log/nginx/error_munin.log;

        server_name_in_redirect off;
        root /var/www;

        # Used to setup our munin subdirectory, and a password protection
        location /munin/ {
                #root /var/www/munin;
                auth_basic "Administrator Login";
                auth_basic_user_file /etc/munin/munin-htpasswd;
        }

        location /munin/static/ {
                alias /etc/munin/static/;
                expires modified +1w;
        }

}

Finally we should restart nginx and munin services:

 

service nginx reload
service minin-node restart

To enable aditional munin modules, please, see sources at the bottom of this post.

Sources