Learn Monitor Debian Server Status with Munin

May 1, 2019

Table of Contents

Munin is a monitoring tool to survey processes and resources in your machine and presents the information in graphs through a web interface.

Use the following steps to setup Munin on your machine and view your web interfaces with Apache.

Install required packages

apt-get install munin munin-plugins-extra libwww-perl apache2-utils

Create user to access the web interface

htpasswd -c /etc/munin/.htpasswd munin

This step will prompt for password.

Enable plugins for monitoring

Choose which plugin to be enabled by creating symbolic link to it:

ln -s /usr/share/munin/plugins/cpu /etc/munin/plugins/cpu
ln -s /usr/share/munin/plugins/df /etc/munin/plugins/df
ln -s /usr/share/munin/plugins/forks /etc/munin/plugins/forks
ln -s /usr/share/munin/plugins/fw_packets /etc/munin/plugins/fw_packets
ln -s /usr/share/munin/plugins/ip_127.0.0.1 /etc/munin/plugins/ip_127.0.0.1
ln -s /usr/share/munin/plugins/load /etc/munin/plugins/load
ln -s /usr/share/munin/plugins/memory /etc/munin/plugins/memory
ln -s /usr/share/munin/plugins/processes /etc/munin/plugins/processes
ln -s /usr/share/munin/plugins/threads /etc/munin/plugins/threads
ln -s /usr/share/munin/plugins/uptime /etc/munin/plugins/uptime
ln -s /usr/share/munin/plugins/exim_mailqueue /etc/munin/plugins/exim_mailqueue
ln -s /usr/share/munin/plugins/exim_mailstats /etc/munin/plugins/exim_mailstats
ln -s /usr/share/munin/plugins/postfix_mailstats /etc/munin/plugins/postfix_mailstats
ln -s /usr/share/munin/plugins/postfix_mailqueue /etc/munin/plugins/postfix_mailqueue
ln -s /usr/share/munin/plugins/mysql_queries /etc/munin/plugins/mysql_queries
ln -s /usr/share/munin/plugins/nginx_request /etc/munin/plugins/nginx_request
ln -s /usr/share/munin/plugins/nginx_status /etc/munin/plugins/nginx_status
ln -s /usr/share/munin/plugins/apache_accesses /etc/munin/plugins/apache_accesses
ln -s /usr/share/munin/plugins/apache_processes /etc/munin/plugins/apache_processes

Edit configuration

Edit /etc/munin/munin.conf file for some basic settings.

Find and change [localhost.localdomain] to your own hostname such as server1.example.com.

Open and edit /etc/apache2/conf.d/munin.

Comment the following lines:

Order allow,deny
Allow from localhost 127.0.0.0/8 ::1
Options None

Then, uncomment the following lines to enable authentication:

# AuthUserFile /etc/munin/.htpasswd
# AuthName "Munin"
# AuthType Basic
# require valid-user

Extras

If your Apache is listening on port other than 80, edit /etc/munin/plugin-conf.d/munin-node

Add following lines to the end of file if your Apache is listening to port 8080:

[apache_*]
env.ports 8080

Finish

Finally, restart your services.

/etc/init.d/munin-node restart
/etc/init.d/apache2 restart

You can now access your munin web interface at http://YOUR_SERVER_IP/munin.

The Munin graphs will be available after few minutes.

Need help?

Do you need help setting up this on your own service?
Please contact us and we’ll provide you the best possible quote!