This is an old revision of the document!
How to set up Munin monitoring
Munin is a lightweight and simple monitoring system. It's very useful for collecting statistics about different networked machines, including NAS devices like DNS-323. Munin consists of a master that collects data from a number of nodes, and this tutorial describes how to configure DNS-323 to act as a Munin node.
Munin node
This article assumes that ffp is already installed on the device.
You should login to the device either over ssh or telnet, cd to a directory on a filesystem with enough free space and download the Munin packages (currently hosted on the forum)
# chdir /mnt/HD_a2 # wget http://www.inreto.de/dns323/fun-plug/0.5/extra-packages/perl/perl-5.10-2.tgz # wget -O munin-node-1.4.5-1.tgz http://forum.dsmg600.info/attachment.php?item=659 # wget -O perl-mod-Net-Server-0.99-1.tgz http://forum.dsmg600.info/attachment.php?item=661
When the download is complete you should install the packages
# funpkg -i perl-5.10-2.tgz Installing package perl-5.10-2 ... # funpkg -i perl-mod-Net-Server-0.99-1.tgz Installing package perl-mod-Net-Server-0.99-1 ... # funpkg -i munin-node-1.4.5-1.tgz Installing package munin-node-1.4.5-1 ... [...] Executing install script for munin-node-1.4.5-1 ...
Munin has a modular architecture, and information about individual components of the system is provided by plugins. None are installed by default, but there is an auto-detection mechanism that tries to guess which plugins might be useful on a given machine. You can either configure plugins manually by symlinking scripts from /ffp/lib/plugins/cpu
to /ffp/etc/munin/plugins/
or allow Munin to do this automatically using
# perl /ffp/sbin/munin-node-configure --shell | sh -x # The following plugins caused errors: [...] + ln -s /ffp/lib/plugins/cpu /ffp/etc/munin/plugins/cpu + ln -s /ffp/lib/plugins/diskstats /ffp/etc/munin/plugins/diskstats + ln -s /ffp/lib/plugins/entropy /ffp/etc/munin/plugins/entropy + ln -s /ffp/lib/plugins/forks /ffp/etc/munin/plugins/forks + ln -s /ffp/lib/plugins/fw_packets /ffp/etc/munin/plugins/fw_packets + ln -s /ffp/lib/plugins/http_loadtime /ffp/etc/munin/plugins/http_loadtime + ln -s /ffp/lib/plugins/interrupts /ffp/etc/munin/plugins/interrupts + ln -s /ffp/lib/plugins/iostat /ffp/etc/munin/plugins/iostat + ln -s /ffp/lib/plugins/iostat_ios /ffp/etc/munin/plugins/iostat_ios + ln -s /ffp/lib/plugins/irqstats /ffp/etc/munin/plugins/irqstats + ln -s /ffp/lib/plugins/load /ffp/etc/munin/plugins/load + ln -s /ffp/lib/plugins/memory /ffp/etc/munin/plugins/memory + ln -s /ffp/lib/plugins/nfs4_client /ffp/etc/munin/plugins/nfs4_client + ln -s /ffp/lib/plugins/nfsd /ffp/etc/munin/plugins/nfsd + ln -s /ffp/lib/plugins/nfsd4 /ffp/etc/munin/plugins/nfsd4 + ln -s /ffp/lib/plugins/open_files /ffp/etc/munin/plugins/open_files + ln -s /ffp/lib/plugins/open_inodes /ffp/etc/munin/plugins/open_inodes + ln -s /ffp/lib/plugins/proc_pri /ffp/etc/munin/plugins/proc_pri + ln -s /ffp/lib/plugins/processes /ffp/etc/munin/plugins/processes + ln -s /ffp/lib/plugins/swap /ffp/etc/munin/plugins/swap + ln -s /ffp/lib/plugins/threads /ffp/etc/munin/plugins/threads + ln -s /ffp/lib/plugins/uptime /ffp/etc/munin/plugins/uptime + ln -s /ffp/lib/plugins/users /ffp/etc/munin/plugins/users
Munin plugins are simple scripts with plain-text output that can be tested using munin-run
# perl -T /ffp/sbin/munin-run cpu user.value 6639837 nice.value 0 system.value 6932479 idle.value 186026521 iowait.value 2634360 irq.value 8 softirq.value 209867 steal.value 0
Be aware that some plugins may require additional dependencies.
By default a Munin node accepts connections only from localhost, so you should modify /ffp/etc/munin/munin-node.conf
to allow at least the Munin master to connect
allow ^127\.0\.0\.1$ allow ^191\.168\.1\.2$
Of course you should substitute 191.168.1.2 with the IP of the Munin master. The addresses look strange because the allow
directives takes Perl regular expressions.
The next step is to enable the munin-node
daemon
# chmod a+x /ffp/start/munin-node.sh # /ffp/start/munin-node.sh start
In order to verify that the node is up and running you can connect to it and invoke a command listing all available plugins
# nc localhost 4949 # munin node at localhost list << YOU SHOULD TYPE THIS AND PRESS ENTER cpu entropy forks fw_packets http_loadtime interrupts ...
For additional security you can run munin-node
from inetd or tunnel it over SSH, but this is beyond the scope of this tutorial.
Munin master
When the node is up and running all that you need is a master that will collect the data and visualize it in a meaningful way.
The Munin master should be installed on a computer that is always on and has network access to all the nodes. Every decent Linux distribution should have a Munin package available, and if not you should follow the documentation. From now on I assume that you use a Debian-based distribution, in which case the installation is as simple as
$ sudo apt-get install munin
Then you should edit the /etc/munin/munin.conf
configuration file and add a following entry
[dns323] address 192.168.1.2 use_node_name yes
Instead of dns323
you can put any other string that identifies the device, for example its hostname, and instead of 192.168.1.2
you should provide the IP address of the node.
When this is done you don't have to restart anything, the Munin master is a process executed from cron, not a daemon. You just have to wait about 5 minutes for the next cron invocation and check the HTML output by opening the following URL in a browser
file:///var/cache/munin/www/index.html
This directory contains static HTML output that can be either viewed locally or served using any HTTP server. In case of problems the logs of the Munin master are available at /var/log/munin/munin-update.log
.
You can see a sample output from the Munin master at the demo installation.