DNS 320, 323 & 325 - Funplug 0.7 : Install a Munin node with Muninlite

Contents[Hide]

dropcap-dns325-munin

If you are the owner of a DNS-323, DNS-320 or DNS-325 NAS device, you may have noticed that there is no simple way to supervise like any other network equipment.

In some previous articles, I explained how to install Net-SNMP on these devices to be able to supervise them. Main advantage of SNMP is that you'll be able to use any supervision tool like Nagios, Munin, ...

But, if you are using a Munin supervision console, a simple approach would be to install a munin node client on your NAS. But munin-node client compilation is quite tricky on devices like DNS-323 & DNS-325.

So, another approach to get a Munin node is to use Muninlite client, which has been especially designed to be installed on tiny devices with limited OS capabilities.

This article explains how to install and configure a Muninlite client on a DNS-323, DNS-320 or DNS-325 NAS running funplug. This will allow you to supervise your NAS device thru any Munin supervision console.

As a pre-requisite, funplug 0.7 must be installed on your NAS device and your compilation environment operational.

Installation guides are available for :

1. Install PERL

If not already done, install PERL and standard modules.

It will be used by muninlite installation procedure and may be used by some plugins.

DNS 32x console
# slacker -a perl perl-modules

2. Download Muninlite

Next step is to download latest Muninlite package from the project site.

Package will be unpacked under /ffp/share/munin.

DNS 32x console
# wget http://downloads.sourceforge.net/project/muninlite/muninlite%20-%20stable/1.0.4/muninlite-1.0.4.tar.gz
# tar -zxvf muninlite-1.0.4.tar.gz -C /ffp/share
# mv /ffp/share/muninlite* /ffp/share/munin
# chown -R root:root /ffp/share/munin
# cd /ffp/share/munin

Muninlite has a static way of handling plugins.

Original plugin selection has to be done thru a set of plugins provided in the package via PLUGINS variable in the Makefile before running the make process. These plugins are available under /ffp/share/munin/plugins.

Starting from Muninlite 1.03, plugin selection can also be done dynamically thru their presence in a specific directory. This mechanism is initiated by adding plugindir_ in the PLUGINS variable.

So, to copy Apache way of dynamically declaring its modules thru symlinks, we will use a specific setup :

  • Muninlite static plugins will be converted to standard Munin plugins
  • Muninlite will be configured to use only dynamic plugins
  • All plugins will be declared in a specific directory with symlinks

With this setup, you'll use these dierctories :

/ffp/share/munin/plugins  Munilite static plugins (converted to shell scripts) 
 /ffp/share/munin/plugins-extra Extra plugins for your NAS (see below)
 /ffp/share/munin/plugins-enabled Symbolic links to enabled plugins

 These commands will setup this environment :

DNS 32x console
# mkdir -p /ffp/share/munin/plugins-enabled /ffp/share/munin/plugins-extra
# sed -i 's/^PLUGINPATTERN.*$/PLUGINPATTERN=\/ffp\/share\/munin\/plugins-enabled\/\*/g' /ffp/share/munin/munin-node.in
# sed -i 's/^PLUGINS.*$/PLUGINS=plugindir_/g' /ffp/share/munin/Makefile

4. Convert Muninlite to Munin-node plugins

As we want to be able to declare any plugin dynamically, we'll need to convert all static plugins provided with muninlite to some standard Munin-node plugin scripts.

Next commands will do this conversion. As these plugins will become normal Munin-node scripts, they'll also have to be declared as executable.

DNS 32x console
# sed -i '1i#!\/ffp\/bin\/sh' /ffp/share/munin/plugins/*
# sed -i 's/^config_.*{/if [ \"\$1\" = \"config\" ]; then {/g' /ffp/share/munin/plugins/*
# sed -i 's/^fetch_.*{/else {/g' /ffp/share/munin/plugins/*
# sed -i '$s/$/\nfi/' /ffp/share/munin/plugins/*
# chmod +x /ffp/share/munin/plugins/*

You now have plain munin-node plugin scripts under /ffp/share/munin/plugins. You can test them :

DNS 32x console
# /ffp/share/munin/plugins/load config
graph_title Load average
graph_args --base 1000 -l 0
graph_vlabel load
graph_scale no
graph_category system
load.label load
load.warning 10
load.critical 120
graph_info The load average of the machine describes how many processes are in the run-queue (scheduled to run "immediately").
load.info Average load for the five minutes.
# /ffp/share/munin/plugins/load
load.value 0.01

5. Install Muninlite

Everything is now ready for final assembly.

A make command in /ffp/share/munin directory will generate final munin-node script including all declared plugins.

You'll then need to :

  1. update shebang to /ffp/bin/sh
  2. add a cd command at the beginning of the script to avoid some silly warning
  3. move munin-node to /ffp/bin so that it becomes accessible thru the PATH
  4. make it executable

DNS 32x console
# cd /ffp/share/munin
# make
Making munin-node for muninlite version 1.0.4
Adding plugin plugindir_
# sed -i 's/^#!\/bin\/sh.*$/#!\/ffp\/bin\/sh\ncd/g' /ffp/share/munin/munin-node
# cp /ffp/share/munin/munin-node /ffp/bin
# chmod +x /ffp/bin/munin-node

6. Declare munin service

As Muninlite runs thru inetd and listens on 4949/TCP port, we have to declare the service in /etc/services :

DNS 32x console
# echo "munin 4949/tcp lrrd # Munin" >>/etc/services

To make it permanent across reboot, you need to add these lines at the end of /ffp/etc/fun_plug.init

/ffp/etc/fun_plug.init
...
# declare munin service
echo "munin 4949/tcp lrrd # Munin" >>/etc/services

7. Declare munin to inetd

We can now declare munin-node script to inetd daemon.

Declaration is done in /ffp/etc/inetd.conf.

DNS 32x console
# echo "munin stream tcp nowait root /ffp/bin/munin-node" >> /ffp/etc/inetd.conf

If not already done, enable inetd daemon and (re)start it :

DNS 32x console
# chmod +x /ffp/start/inetd.sh
# /ffp/start/inetd.sh restart

Your NAS is now running a Nunin node thru Muninlite client.

8. Download extra plugins

It's now time to download whatever extra plugin you need under /ffp/share/munin/plugins-extra.

These plugins should be standard Munin node plugins but they may need to be patched to comply with the specific funplug environment. For example, shebang may have to be changed to #!/ffp/bin/bash.

You can find some specific DNS-32x plugins under my GitHub Munin Plugins repository. Some of these plugins need some specific dependencies. Check the plugin header to get information.

Here is an example of extra plugins installation for DNS-323 :

  • uptime patched plugin
  • fan speed and case & disk temperature plugin

Once plugins are downloaded, make sure they are executables.

DNS 32x console
# wget --no-check-certificate -O /ffp/share/munin/plugins-extra/dns323_uptime https://raw.githubusercontent.com/NicolasBernaerts/munin-plugin/master/dns323_uptime
# wget --no-check-certificate -O /ffp/share/munin/plugins-extra/dns32x_temperature https://raw.githubusercontent.com/NicolasBernaerts/munin-plugin/master/dns32x_temperature
# chmod +x /ffp/share/munin/plugins-extra/*

9. Enable Plugins

Last, but not least step is to declare the plugins you want to run.

This is simply done by creating symbolic links in /ffp/share/munin/plugins-enabled to the plugin scripts you want to enable. For example :

DNS 32x console
# ln -s /ffp/share/munin/plugins/cpu /ffp/share/munin/plugins-enabled/cpu
# ln -s /ffp/share/munin/plugins/load /ffp/share/munin/plugins-enabled/load
# ln -s /ffp/share/munin/plugins/memory /ffp/share/munin/plugins-enabled/memory
# ln -s /ffp/share/munin/plugins-extra/dns323_uptime /ffp/share/munin/plugins-enabled/dns323_uptime
# ln -s /ffp/share/munin/plugins-extra/dns32x_temperature /ffp/share/munin/plugins-enabled/dns32x_temperature

10. Test Munin node

You can now test your Munin node installation :

DNS 32x console
# telnet localhost 4949
# munin node at NAS-DNS323
list
cpu dns323_uptime dns32x_process dns32x_temperature memory rsync_connexion
fetch dns323_uptime
uptime.value 170068.73
.
quit
Connection closed by foreign host

Your new munin node seems to be fully operationnal.

You can now declare it as a Munin node on your Munin supervision server.

 

Hope it helps.

Signature Technoblog

This article is published "as is", without any warranty that it will work for your specific need.
If you think this article needs some complement, or simply if you think it saved you lots of time & trouble,
just let me know at This email address is being protected from spambots. You need JavaScript enabled to view it.. Cheers !

icon linux icon debian icon apache icon mysql icon php icon piwik icon googleplus