Munin monitoring on RaspberryPi/DietPi

By | February 5, 2019

Here’s the situation. I have an Odroid XU4 and Raspberry Pi, both of them running with DietPi image. The mission is to perform system monitoring for both of the system.

Install Munin server

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

apt-get updateapt-get upgrade

Apache is used to show the Munin pages, the apache fcgid module is required for the Munin graph zoom feature. Install apache and the fcgid module with apt.

apt-get install apache2 libcgi-fast-perl libapache2-mod-fcgid

Enable the fcgid module in apache.

a2enmod fcgid

Install & Configure Munin

To install Munin on DietPi, we do this:

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

Next, we must edit the Munin configuration file /etc/munin/munin.conf. Uncomment the dbdirhtmldirlogdirrundir, and tmpldir lines (the default values are fine). We want Munin to use the name raspiblack.local instead of localhost.localdomain in the HTML output, therefore we replace localhost.localdomain with raspiblack.local in the simple host tree section. Without the comments, the changed file looks like this:

nano /etc/munin/munin.conf
# Example configuration file for Munin, generated by 'make build'

# The next three variables specifies where the location of the RRD
# databases, the HTML output, logs and the lock/pid files. They all
# must be writable by the user running munin-cron. They are all
# defaulted to the values you see here.
#
dbdir /var/lib/munin
htmldir /var/cache/munin/www
logdir /var/log/munin
rundir /var/run/munin

# Where to look for the HTML templates
#
tmpldir /etc/munin/templates

# Where to look for the static www files
#
#staticdir /etc/munin/static

# temporary cgi files are here. note that it has to be writable by
# the cgi user (usually nobody or httpd).
#
# cgitmpdir /var/lib/munin/cgi-tmp # (Exactly one) directory to include all files from. includedir /etc/munin/munin-conf.d [...] # a simple host tree
[raspiblack.local]
address 127.0.0.1
use_node_name yes
[XU4.local]
address 192.168.1.6
use_node_name yes [...]

Run these commands to enable and load the configuration into apache.

cd /etc/apache2/conf-enabled/ln -s /etc/munin/apache24.conf munin.confservice apache2 restart

Make sure you comment out the line Require local and add Require all granted and Options FollowSymLinks SymLinksIfOwnerMatch instead (otherwise you will only be able to access the Munin output from localhost):

nano /etc/munin/apache24.conf
Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
 # Require local
 Require all granted
 Options FollowSymLinks SymLinksIfOwnerMatch
 Options None
</Directory>

ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
 # Require local
 Require all granted
 Options FollowSymLinks SymLinksIfOwnerMatch
 <IfModule mod_fcgid.c>
 SetHandler fcgid-script
 </IfModule>
 <IfModule !mod_fcgid.c>
 SetHandler cgi-script
 </IfModule>
</Location>

Restart Apache:

service apache2 restart

Then restart Munin:

service munin-node restart

Install munin node on XU4

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

Edit munin node configuration

nano /etc/munin/munin-node.conf

Change munin node identification and allow probe

host_name XU4.local 
allow ^192\.168\.1\.230$

192.168.1.230 is the address of the munin server

Then restart Munin:

service munin-node restart

Now wait a few minutes so that Munin can produce its first output, and then go to http://munin-server-ip-address/munin/ in your browser, and you see the first statistics.

References:
https://www.howtoforge.com/tutorial/server-monitoring-with-munin-and-monit-on-debian/

https://www.digitalocean.com/community/tutorials/how-to-install-the-munin-monitoring-tool-on-debian-8

Loading