wiki:HowToOpenWRT

HowTo run munin-node on OpenWRT

Attention: Content of this page should be moved to the Munin-Guide --> Visit the Guide now.

Using muninlite from OpenWRT backfire

backfire and newer releases contain muninlite from (from http://muninlite.sf.net) which is a simple implementation of munin-node in shell, thus making the probelms with non-existing perl obsolete. Muninlite needs a running xinetd (or another inetd service). After installing muninlite and xinetd you need to make sure xinetd is started at boot, by creating an approriate symlink in /etc/rc.d/ - optionally you might want to further restrict access by editing /etc/xinetd.conf/munin or configuring your firewall.

Outdated

This information is outdated and applies to OpenWRT KAMIKAZE. Checkout this updated script by Bushmills. https://dev.openwrt.org/ticket/7167 Its an all in one script!

Quick start

Espen Braastad has kindly submitted an .ipk file (attached at the bottom of this page), providing the modified version of munin-node-simple and several modified plugins, as well as the required xinetd.d file and most of the remaining requirements. This package should be all you need for the installation. Please do read the instructions below anyway!

Obtain and modify simple-munin-node

First of all, get munin-node-simple from source:trunk/node/munin-node-simple.in and install it on your OpenWRT device. For simplicity, move it to the /usr/bin/ directory.

A few paths must be specified in this file, namely the path to the perl binary (which will be /usr/bin/microperl) and the paths to the plugins directory and to the configuration file.

Below is a diff between the SVN repository and the final file:

$ diff -Naur munin-node-simple.in munin-node
--- munin-node-simple.in     2006-11-14 23:30:09.000000000 +0100
+++ munin-node  2006-11-14 23:30:15.000000000 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -wT
+#!/usr/bin/microperl -w
 #
 # Copyright (C) 2004 Jimmy Olsen, Audun Ytterdal
 #
@@ -24,13 +24,13 @@
 # security environments.
 #

-use strict;
+# use strict;

 $| = 1;

-my $clientdir = "@@CONFDIR@@/node.d";
-my $conffile  = "@@CONFDIR@@/node-simple.conf";
-my $version   = "@@VERSION@@";
+my $clientdir = "/etc/munin/plugins/";
+my $conffile  = "/etc/munin/munin-node.conf";
+my $version   = "1.2.5";

 # Empty environment
 %ENV = ();

Directories and files

You need to create the above mentioned directories and files manually.

mkdir -p /etc/munin/plugins

These are the contents of my /etc/munin/munin-node.conf file:

hostname linksys-router.hjemme.ruberg.no
clientdir /etc/munin/plugins

Install required OpenWRT packages

Then you need a few prerequisites:

ipkg install xinetd microperl

To make your life easier, you could create a symlink so that /usr/bin/perl points to your microperl binary.

/etc/services entry

Add the munin TCP service port to /etc/services:

munin   4949/tcp

xinetd service file

Create a file named munin-node in /etc/xinetd.d/, with the following contents:

service munin
{
 port            = 4949
 socket_type     = stream
 wait            = no
 server          = /usr/bin/munin-node
 user            = root
 group           = root
 only_from       = 10.0.0.10
}

Now make sure that the xinetd process is running.

xinetd startup file

If you installed xinetd vi ipkg, then make sure /etc/init.d/S??xinetd exists. I've noticed that "ipkg install xinetd" installs /etc/init.d/xinetd, which will NOT be run at startup. Simply linking /etc/init.d/xinetd to /etc/rc.d/S70xinetd (ln -s /etc/init.d/xinetd /etc/rc.d/S70xinetd) solves the problem.

Populate the plugins directory

Now, copy or symlink all the plugins you want into the /etc/munin/plugins/ directory.

Then remove perl-specific features not supported in microperl by deleting use strict; from any plugins in which this stanza exist. Alternatively, you can create a workaround described below.

If you want to (and you do if you use wildcard plugins), feel free to create /usr/share/munin/plugins or another out-of-the-way directory from which you may link plugins.

Now, I have the following in the plugin directory:

cpu
forks
fw_conntrack
if_err_eth0 -> /usr/share/munin/plugins/if_err_
if_err_eth1 -> /usr/share/munin/plugins/if_err_
if_err_vlan0 -> /usr/share/munin/plugins/if_err_
if_err_vlan1 -> /usr/share/munin/plugins/if_err_
if_eth0 -> /usr/share/munin/plugins/if_
if_eth1 -> /usr/share/munin/plugins/if_
if_vlan0 -> /usr/share/munin/plugins/if_
if_vlan1 -> /usr/share/munin/plugins/if_
interrupts
irqstats
load
memory
proc_priority
uptime
vmstat

Workaround for perl's use strict

Find where your installation of microperl searches for modules:

# microperl -V
Can't locate Config.pm in @INC (@INC contains: /usr/local/lib/perl5/5.9 .).
BEGIN failed--compilation aborted.

Then create a file named strict.pm in the directory shown in the output. In my case, the directory had to be created. The content of strict.pm is this:

package strict;
1;
__END__

Test that everything's working

Telnet to your OpenWRT device, port 4949, to verify that xinetd launches munin-node properly.

$ telnet 10.0.0.1 4949
Trying 10.0.0.1...
Connected to 10.0.0.1.
Escape character is '^]'.
# munin node at linksys-router.hjemme.ruberg.no
list
fw_conntrack proc_priority if_err_eth0 if_vlan0 irqstats cpu if_eth1 if_err_vlan1 if_err_eth1 if_eth0 \
   if_vlan1 forks memory interrupts uptime vmstat load if_err_vlan0
quit
Connection closed by foreign host.

If everything is OK, then it's time to celebrate, or at least find something fun to do while waiting for Munin to create snazzy graphs from your router!

Signal / Noise ratio of associated stations

Please see brc_rssi at Muninexchange.

Last modified at 2015-07-20T14:01:01+02:00 Last modified on 2015-07-20T14:01:01+02:00

Attachments (1)

Download all attachments as: .zip