Monitoring your Linux VPS usage using Munin on CentOS 7.4 and Ubuntu 17.04


Monitoring your VPS is a very important part of maintenance. Surely, when you run a single VPS, it may be easier just to quickly do an SNMP request, or even log in and check it manually. However if you have a park of machines, or want to make monitoring even of a single instance easier, it is better to use a specific software.


This guide will cover an installation and usage of a Munin[1] tool. Munin consists of two independant parts: server ( munin itself ), that is installed on single machine, where all data is gathered, and small munin-node daemons, that are installed on monitored servers. A big feature of Munin is plugin support, that can expand it's usability a lot. They are also farely easy to write yourself. In fact each plugin is an executable file, that gathers the required information and give it as an output. In this guide we will install munin-daemon on Linux machine, and also setup one more Linux VPS to be a munin server.


Centos 7.4 VPS server Ubuntu 17.04 VPS server Basic knowledge of installing and configuring software on Linux

Master setup

It will be running on Ubuntu 17.04 VPS 1) run apt-get install munin It will pull a bunch of other packages as well, this is normal 2) we also need apache and fcgid module to display the information

apt-get install apache2 libapache2-mod-fcgid

enable fcgid module

a2enmod fcgid

munin1 It may tell you, that module is already enabled, this is normal

3) Enable apache configuration for munin

ln -s /etc/munin/apache24.conf /etc/apache2/conf-available/apache24.conf
ln -s /etc/apache2/conf-available/apache24.conf /etc/apache2/conf-enabled/munin.conf


4) enable access to all hosts edit /etc/munin/apache24.conf replace Require local with Require all granted munin35) Replace server name and ip address for your munin master edit /etc/munin/munin.conf and replace

    use_node_name yes

with your sample name, for example i have used my ip address as a name

    use_node_name yes

6) Restart your service and check that it is running ok

systemctl enable munin-node
systemctl start munin-node
systemctl status munin-node

munin4 Now you can already access your munin instance and see the host, it is running on is monitored for example my link will be

Linux client installation

Client will be installed on Centos 7.4 There are two options: * Installing prepackaged Centos versions you can see that they are available by running yum search munin * Building and installing latest upstream build[2]

Usually i prefer upstream packages, but in this case, it is much easier to installed prepackaged centos version, to avoid manual building and installation ( and make package-based system maintenance and update process easier ). So we will choose first option. 1) run yum install munin-node Please notice that a bunch of perl packages will be pulled as well, this is normal munin52) Now let's configure the node main config file is /etc/munin/munin-node.conf

Options are: host_name - this is the hostname, munin master will use to identify the agent. It should be change, if you have custom agent hostname on master ignore_file - what plugins should be ignored paranoia - true or false, true allows munin to run plugins only owned by root

Here are some other common options:

log_level - 0-4, where 0 - no logging, 4 - very verbose log_file - location of log file pid_file - pid file background - set to 1 to run in background user - the user from which munin is executed group - the group from which munin is executed setsid - 1 means that daemon will fork itself, frees from command line and run as a daemon global_timeout - after each time drop the connection to master timeout - timeout for each single plugin to hold the connection allow - defines what hosts may connect to this munin node cidr_allow - allowed hosts in CIDR notation ( cidr_deny - same as cidr_allow, but to deny hosts host - ip address, on which munin node listens port - port, on which munin node listens

Here is the example of typical config file

# Example config-file for munin-node

log_level 4
log_file /var/log/munin-node/munin-node.log
pid_file /var/run/munin/

background 1
setsid 1

user root
group root

# This is the timeout for the whole transaction.
# Units are in sec. Default is 15 min
# global_timeout 900

# This is the timeout for each plugin.
# Units are in sec. Default is 1 min
# timeout 60

# Regexps for files to ignore
ignore_file [\#~]$
ignore_file DEADJOE$
ignore_file \.bak$
ignore_file %$
ignore_file \.dpkg-(tmp|new|old|dist)$
ignore_file \.rpm(save|new)$
ignore_file \.pod$

# Set this if the client doesn't report the correct hostname when
# telnetting to localhost, port 4949
host_name localhost.localdomain

# A list of addresses that are allowed to connect.  This must be a
# regular expression, since Net::Server does not understand CIDR-style
# network notation unless the perl module Net::CIDR is installed.  You
# may repeat the allow line as many times as you'd like

allow ^127\.0\.0\.1$
allow ^::1$

# If you have installed the Net::CIDR perl module, you can use one or more
# cidr_allow and cidr_deny address/mask patterns.  A connecting client must
# match any cidr_allow, and not match any cidr_deny.  Note that a netmask
# *must* be provided, even if it's /32
# Example:
# cidr_allow
# cidr_allow
# cidr_deny

# Which address to bind to;
host *
# host

# And which port
port 4949

3) Let's add our master node to the allowed list open /etc/munin/munin-node.conf and edit default

allow ^127\.0\.0\.1$

string to reflect the IP address of your Munin master node. In my case IP is so string will look like

allow ^185\.181\.8\.78$

4) Now let's start, enable service and check that it is running OK

systemctl start munin-node
systemctl enable munin-node
systemctl status munin-node


Adding our server to munin master to be monitored:

1) On munin master ( Ubuntu ) edit


find your host definition

    use_node_name yes

copy and paste it and replace data with your monitored node date, for my Centos server it will look like

    use_node_name yes

Confirm that it is available and restart apache2

cat /etc/munin/munin.conf |grep -A 2 -B 2 address


systemctl restart apache2

It takes some time for munin to update itself, but after it's done, host will appear on your master node web GUI for munin! munin8


Now you now how to setup a powerful and useful monitoring application that can track resources of your multiple VPS and physical servers. It makes life of administrator much easier and give you and easy way to see the timeline of system resource usage.