wiki:MuninInstallationSolaris

Installation of a Munin Node on Solaris 10 x86

This documentation details how to install a Munin node on Solaris 10. Here we use Solaris 10 x86, but it should work on Sparc processors as well, just modify what versions of software you download from sunfreeware.com

Let's get started.

Requirements:

Solaris 10 x86
gnu make
perl
perl packages: 
Net::Server
Module::Build
Time::HiRes
HTML::Template
Log::Log4perl
Net::Server
Net::CIDR

1) First create dedicated group and 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 SunFreeware?: 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 SourceForge? 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 at the same place as RPMS on Linux.

NOTE: First backup the config file.

cp Makefile.config Makefile.config.ORIG
vi Makefile.config

NOTE: The file should look something like this: CRITICAL NOTE: Please note this is a fragment of the entire config file, so DO NOT delete the whole thing and cut and paste it. The PREFIX, CONFDIR, LOGDIR, STATEDIR and DBDIR are modified.

#########################################################################
# This file specifies where Munin will look for things after you've
# run 'make' in the source directory.  Modify it to suit your needs.</code>

# 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&gt;/dev/null)
CHECKUSER  = $(shell $(GETENT) passwd $(USER) &gt;/dev/null 2&gt;/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2"))
CHECKGROUP = $(shell $(GETENT) group $(GROUP) &gt;/dev/null 2&gt;/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 using 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, due 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. Please note newer versions already include fixes for various Munin and plugins bugs on Solaris 10 and OpenSolaris?.

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. This IP will be part of regexp, so should be written escaping special characters. 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 try to autoconfigure all of the plugins that are relevant to your system. Adapt manually later to best fit your needs.

/usr/local/munin/sbin/munin-node-configure --shell --families=contrib,auto | sh -x

12) Now let's test to see if Munin is working. 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, no 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 find 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

# Setting up munin-node as a SMF service

18) 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

<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type="manifest" name="export">
 <service name="application/munin-node" type="service" version="0">
   <create_default_instance enabled="true"/>
   <single_instance/>
   <dependency name="fs" grouping="require_all" restart_on="none" type="service">
     <service_fmri value="svc:/system/filesystem/local"/>
   </dependency>
   <dependency name="network" grouping="require_all" restart_on="none" type="service">
     <service_fmri value="svc:/milestone/network:default"/>
   </dependency>
   <dependency name="name-services" grouping="require_all" restart_on="none" type="service">
     <service_fmri value="svc:/milestone/name-services:default"/>
   </dependency>
   <exec_method name="start" type="method" exec="munin-node" timeout_seconds="60">
     <method_context>
       <method_credential user="root" group="root"/>
       <method_environment>
         <envvar name="PATH" value="/usr/local/munin/sbin:/usr/bin:/bin:/opt/csw/bin"/>
       </method_environment>
     </method_context>
   </exec_method>
   <exec_method name="stop" type="method" exec=":kill" timeout_seconds="60">
     <method_context/>
   </exec_method>
 </service>
</service_bundle>

19) Validate the service bundle file:

svccfg -v validate /path/to/munin-node.xml

20) Import the file:

svccfg -v import /path/to/munin-node.xml

21) Verify:

svcs -a

22) You should see the service "application/munin-node" is enabled. If not, try this to debug it:

svcs -x -v

23) 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!

Last modified at 2014-01-03T20:30:55+01:00 Last modified on 2014-01-03T20:30:55+01:00