Muninのソースコード自体は公式サイトなどから入手。依存関係のあるNetServerは、例えばp5-net-serverをMacPortsからインストール。
Muninを動かすユーザの準備と、インストール先などの指定をMakefile.configで行うのが主な作業。
ユーザの準備。[Mac OS X] ユーザ作成手順(dscl) - Life with ITが参考になる。Nodeとして動かす場合はグループだけ作成すればよさそう。
sudo dscl . -create /Groups/munin gid XXX
Gidはダブらないものを適当に。
Makefile.config。ユーザ/グループのチェックは不要ということで、デフォルトのままにしておく。
# 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
# Where Munin keeps its configurations (server.conf, client.conf, ++)
#CONFDIR = $(DESTDIR)/etc/opt/munin
CONFDIR = $(PREFIX)/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 = $(DESTDIR)/var/opt/munin
DBDIR = $(PREFIX)/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 = $(DESTDIR)/var/log/munin
# Location of PID files and other statefiles. On the server, must be
# writable by the user "munin".
STATEDIR = $(DESTDIR)/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
# A modern (posix) shell. We're not looking for arrays, but $() and
# other modern stuff is expected. On a posix-system the expression
# below will find the right shell. Most Unixes released the last 10
# years are POSIX compliant enough for this to work (he said bravely).
#
# On Linux /bin/sh, SunOS/Solaris /usr/xpg4/bin/sh or /bin/ksh
# In general: bash or ksh will work
#
GOODSH = $(shell PATH=`getconf PATH` sh -c 'type sh | sed "s/.* //"')
# Path of bash for bash specific plugins
BASH = /bin/bash
# Server only - Where to install the perl libraries
PERLLIB = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d"'" -f2)
# 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"))
# For OSX, comment out the previous two lines and comment in these
#CHECKUSER = $(shell nicl . -read /users/$(USER) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistant. Create the user and retry; exit 2"))
#CHECKGROUP = $(shell nicl . -read /groups/$(GROUP) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistant. Create the group and retry; exit 2"))
CHOWN = chown
CHMOD = chmod
CHGRP = chgrp
# Check whether setruid functionality can be used
HASSETR = $(shell perl -e 'use Config; my @vars=("d_setruid", "d_setreuid", "d_setresuid"); foreach my $$var (@vars) { if ($$Config{$$var} eq "define") { print "1\n"; exit 0; } } print "0\n"; exit 0;' )
設定は終わったので、Makefileを見ながらnodeにあたる部分だけをコンパイル、インストール。/usr/local/etc/munin/munin-node.confにgroup rootとあるが、rootというグループはないのでwheelに直す。
/procがないので、pluginの自動検出をやってもほとんど拾えない。snmp経由でコツコツ自分で設定して行くべし。