After we installed all required dependencies, we can start to build munin. This part of the guide describes how to build munin and install a munin-node on a OpenSolaris/OpenIndiana system.
Basics
First we create a user and a group for munin to run as.
root@test:~/perl-5.16.0# cd ~ root@test:~# mkdir -p /export/home root@test:~# useradd -d /export/home/munin -s /usr/bin/false -m munin root@test:~# groupadd munin root@test:~# usermod -g munin munin
Now we are ready to download munin.
root@test:~# wget http://downloads.sourceforge.net/project/munin/stable/2.0.0/munin-2.0.0.tar.gz --2012-06-05 22:29:50-- http://downloads.sourceforge.net/project/munin/stable/2.0.0/munin-2.0.0.tar.gz HTTP request sent, awaiting response... 200 OK Length: 1317614 (1.3M) [application/x-gzip] Saving to: `munin-2.0.0.tar.gz' 100%[===========================================================>] 1,317,614 1.63M/s in 0.8s 2012-06-05 22:29:52 (1.63 MB/s) - `munin-2.0.0.tar.gz' saved [1317614/1317614] root@test:~# tar xf munin-2.0.0.tar.gz root@test:~# cd munin-2.0.0
The munin source contains a config, which will not match our needs. Therefor we have to edit the Makefile.config and set the CONFDIR as following:
CONFDIR = $(DESTDIR)/opt/munin
Now build munin and install it.
root@test:~/munin-2.0.0# gmake root@test:~/munin-2.0.0# gmake install-common-prime root@test:~/munin-2.0.0# gmake install-node root@test:~/munin-2.0.0# gmake install-plugins-prime
Configure Munin
Munin is delivered with a sample config-file which can be used as basic for our new installation. So we copy it and create a folder for the munin logs.
root@test:~/munin-2.0.0# cp build/node/munin-node.conf /opt/munin/ root@test:~/munin-2.0.0# mkdir /var/log/munin root@test:~/munin-2.0.0# chown munin:munin /var/log/munin/
Edit /opt/munin/munin-node.conf and set the logfile to use the new directory and set the run dir:
log_file /var/log/munin/munin-node.log pid_file /var/run/munin-node.pid
There is a cool script available, which tries to enabled a number of plugins automatically. The script contains a reference to the original perl path and has to be edited before we can run it. So change the header
#!/usr/bin/perl -w
to
#!/opt/perl/bin/perl -w
in
/opt/munin/sbin/munin-node-configure
and run it:
root@test:~/munin-2.0.0# /opt/munin/sbin/munin-node-configure --shell -families=contrib,auto | sh -x
The same problem can be found in another file:
#!/usr/bin/perl -wT
to
#!/opt/perl/bin/perl -wT
in
/opt/munin/sbin/munin-node
Munin-Node as Solaris Service
The final step is to integrate the munin-node into Solaris’ Service Management Facility (smf). This requires a XML config file which describes the Munin-Node-service.
The required file can be found here:
root@test:~/munin-2.0.0# cd /tmp/ root@test:/tmp# wget http://www.dev-eth0.de/wp-content/uploads/2012/06/munin.xml root@test:/tmp# svccfg import -V munin.xml
Now we have installed Munin-Node as a Solaris Service and can start and stop it with the svcadm command and check it’s status with svcs.
Commands:
svcadm enable munin-node svcadm disable munin-node
The following commands will start tor and check if everything is ok and running.
root@test:/tmp# svcadm enable munin-node root@test:/tmp# svcs -x munin-node svc:/application/munin-node:default (?) State: online since Tue May 29 23:28:13 2012 See: /var/svc/log/application-munin-node:default.log Impact: None.
