Installing a Munin Node on Solaris 10 x86 the Right Way
This article details the proper way to install a munin node on Solaris 10. In this article I use Solaris 10 x86, but it should work with Sun procs as well. There are a few articles out there on this subject, but most of them are showing some age. I am indebted to this article for getting me started, but it is incomplete. I like documentation that includes every step. Also a few of the steps have changed since the original document was published and following those steps will give you errors in the new versions (version 1.4.1 at the time of this writing), such as calling “gmake install” without calling “gmake” and not creating the munin-node.conf file.
First off, here is a plain text file version of this article with no formatting, so you can see the commands precisely.
The art of being a Unix administrator is being able to get things working when the documentation available to you is non-existent, outdated or broken. This is often the case. A good admin will find 70% of what he needs with the power of Google, fix 10% and figure out or fill in the last 20%, taking notes the whole time. Then he gives back to the community, as I’m doing now. The key is taking notes. If you don’t take notes, you won’t be able to do it again 6 months or a year from now.
Also, I highly recommend including every command in your notes, even simple commands like “mkdir” because it makes it easy to replicate your work later. You don’t want to have to figure out some hole in your documentation. It’s a waste of time. I like my documentation so detailed that I can literally cut and paste all my commands and not have to type a thing, except maybe a different host name or IP address.
Let’s get started.
Requirements: Solaris 10 x86, perl, gnu make, perl packages: Net::Server, Module::Build, Time::HiRes, HTML::Template, Log::Log4perl, Net::Server
1) First create a group and a user
groupadd munin useradd munin
2) Now let’s fix the Munin user, so it can do everything it needs to do on Solaris.
usermod -d /var/munin -s /usr/bin/bash munin cp /home/admin/.profile /var/munin chown munin:munin /var/munin/.profile passwd munin
NOTE: Set your password to whatever you like.
3) We need gmake (GNU Make). Mine is under /usr/sfw/bin. If you do not have it, you can get it for your architecture from Sun Freeware: http://www.sunfreeware.com/
NOTE: Export the path
export PATH="/usr/sfw/bin/:$PATH"
4) Let’s get Munin and download it so we get it compiled. Get munin from http://sourceforge.net/project/showfiles.php?group_id=98117.
mkdir -p /home/computer/utilities/munin-node cd /home/computer/utilities/munin-node/ wget "http://sourceforge.net/projects/munin/files/munin%20stable/1.4.1/munin-1.4.1.tar.gz/download" tar -xzvf munin-1.4.1.tar.gz cd munin-1.4.1/
5) The default makefile puts things in some strange places. It’s best to keep everything in the same places on all your servers. I have modified the config to put everything in the same places as the RPMS install things on Linux.
vi Makefile.config
NOTE: The file should look something like this:
######################################################################### # This file specifies where Munin will look for things after you've # run 'make' in the source directory. Modify it to suit your needs.# DESTDIR is empty during building, and optionally set to point to # a shadow tree during make install. # # the base of the Munin installation. # #PREFIX = $(DESTDIR)/opt/munin PREFIX = /usr/local/munin # Where Munin keeps its configurations (server.conf, client.conf, ++) CONFDIR = /etc/munin # Server only - where to put munin-cron BINDIR = $(PREFIX)/bin # Client only - where to put munin-node, munin-node-configure, and munin-run SBINDIR = $(PREFIX)/sbin # Where to put text and html documentation DOCDIR = $(PREFIX)/doc # Where to put man pages MANDIR = $(PREFIX)/man # Where to put internal binaries and plugin repository LIBDIR = $(PREFIX)/lib # Server only - Output directory HTMLDIR = $(PREFIX)/var/www CGIDIR = $(HTMLDIR)/cgi # Client only - Where to put RRD files and other intenal data DBDIR = /var/munin # Client only - Where plugins should put their states. Must be writable by # group "munin", and should be preserved between reboots PLUGSTATE = $(DBDIR)/plugin-state # Where Munin should place its logs. LOGDIR = /var/log/munin # Location of PID files and other statefiles. On the server, must be # writable by the user "munin". STATEDIR = /var/run/munin # The perl interpreter to use PERL = $(shell which perl) # The python interpreter to use (used by some plugins) PYTHON = /usr/bin/env python # Server only - Where to install the perl libraries PERLLIB = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d= -f2 | sed "s/[';]//g") # Client only - Install plugins for this architecture OSTYPE = $(shell uname | tr '[A-Z]' '[a-z]') # How to figure out the hostname. (Only used in default configuration # files) HOSTNAME = $(shell hostname) # What is the safest way to create a tempfile. # Default is to figure it out by testing various methods. # Replace this with a known platform-specific method MKTEMP = $(shell ./test-mktemp) # Munin version number. VERSION = $(shell cat RELEASE) # User to run munin as USER = munin GROUP = munin # Default user to run the plugins as PLUGINUSER = nobody # Which command to use to check if the USER and GROUP to run Munin as, exists. GETENT = $(shell which getent || which true 2>/dev/null) CHECKUSER = $(shell $(GETENT) passwd $(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2")) CHECKGROUP = $(shell $(GETENT) group $(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2")) CHOWN = chown CHMOD = chmod CHGRP = chgrp #######################################################################################
6) You will also probably need to install some perl modules with cpan. Start cpan, configure it by hitting enter to accept all the defaults. After you have a cpan prompt, you can issue the install commands.
perl -MCPAN -e shell install Module::Build install Time::HiRes install HTML::Template install Log::Log4perl install Net::Server
7) Make the node and the plugins. It’s critical now, do to a bug, that you do “gmake” first (as of version 1.4.1) before you do the other gmake commands. This will probably be fixed in a later version.
gmake gmake install-common-prime gmake install-node gmake install-plugins-prime
NOTE: This overwrites any existing plugins.
8 ) You may get the following error when you make the plugins, which can be safely ignored and which may already be fixed in the version you are using. At the time of this writing I am using 1.4.1
mv /usr/local/munin/lib/plugins/*.adv /usr/local/munin/lib mv: cannot access /usr/local/munin/lib/plugins/*.adv gmake: [install-plugins-prime] Error 2 (ignored)
9) Copy the munin-node.conf to the right directory. It is not there by default.
cp /home/computer/utilities/munin-node/munin-1.4.1/build/node/munin-node.conf /etc/munin/
10) Check the munin-node.conf to make sure it looks the way you want.
NOTE: Always make a backup of the file before editing it.
cp /etc/munin/munin-node.conf /etc/munin/munin-node.conf.ORIG vi /etc/munin/munin-node.conf
CRITICAL NOTE: Be sure to add the IP address of your munin master to IPs that are allowed to connect. So if the IP of your master server is 192.168.0.10 the line would look like:
allow ^192\.168\.0\.10$
NOTE: Put that right under the line that looks like this in the config file:
allow ^127\.0\.0\.1$
11) Decide which plugins to use. this command will autoconfigure all of the plugins that are relevant to your system.
/usr/local/munin/sbin/munin-node-configure --shell --families=contrib,auto | sh -x
12) Now let’s test to see if munin is functioning. We can run the help command to see if we get any errors.
/usr/local/munin/sbin/munin-node --help
NOTE: You should get a printout of the various functions of the binary, not a perl error or some other error. If you get an error, go back, because something is wrong.
13) Now let’s start the node agent (as root)
/usr/local/munin/sbin/munin-node
14) check to see that you can see the process
ps -ef | grep munin
15) Check to see that it is listening on port 4949
netstat -n -a | grep 4949
16) There is a rudimentary Solaris init script under the build/dists or in the build/resources directory, but the proper way to set things up in Solaris 10 is with the SMF in solaris and I detail that below:
NOTE: First a quick primer on SMF
NOTE: Troubleshooting: This will show you problems with services and steps you can take to debug them, such as logfile locations:
svcs -x -v
NOTE: Working with service bundles: Service bundles can be imported or exported from a repository using the svccfg(1M) command. See service_bundle(4) for a description of the service bundle file format with guide- lines for authoring service bundles.
svccfg -v validate /path/to/smf.xml svccfg -v import /path/to/smf.xml
NOTE: Starting and stopping your service:
svcadm enable [service name] svcadm disable [service name]
17) Now Let’s set up munin-node as a SMF service
NOTE: Save this service bundle file on your server. You may need to modify the value attribute of the envvar tag with name=”PATH” to include the path to the munin-node binary. Let’s assume you’ve saved it here: /path/to/munin-node.xml
Download the munin-node XML file you need here, as it will not render right on my blog.
18) Validate the service bundle file:
svccfg -v validate /path/to/munin-node.xml
19) Import the file:
svccfg -v import /path/to/munin-node.xml
20) Verify:
svcs -a
21) You should see the service “application/munin-node” is enabled. If not, try this to debug it:
22) Once you’ve verified it’s running, make sure you can start/stop it:
svcadm disable application/munin-node svcs -a svcadm enable application/munin-node svcs -a
And you’re done. Now just add your munin-node to your master server and it should begin collecting data for you!
Dan Jeffries
Bulldog Data Services
bulldogdata.com
helpdog [AT] bulldogdata.com


I would like to say “wow” what a inspiring post. This is really great. Keep doing what you’re doing!!