wiki:MuninInstallationDarwin

Installation of munin on Mac OS X

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

MacPorts?

Installation using MacPorts is the recommended way to install munin on Mac OS x. You must have javac working (from the Java SE JDK) for the port build to complete successfully. If you first try to install without having javac, you must uninstall the port before retrying once you've installed javac. Otherwise, the port build substitutes incorrect values in the Perl modules.

Use

sudo port install munin +server

to install the munin master instance, and

sudo port install munin

to install the munin node only.

Enable suggested plugins:

sudo -u munin munin-node-configure --suggest --shell | sudo sh

To enable the launchd startup item:

sudo port load munin

Installation from source

Install munin this way only if installation using MacPorts? does not fit your needs for some reason. It is much more difficult than using MacPorts?.

check out the repository

Create a directory for the munin source. This may be /usr/src/munin (or a directory in your $HOME). Then check out the repository: svn checkout svn://munin.projects.linpro.no/munin/trunk /usr/src/munin/ Please do not try to checkout the whole repository, because there are some directories with the same name but with upper and lower cases. Apples HFS+ is not case sensitive; you will run into trouble!

create a user account

There is no command like "useradd" or "adduser". But because the Account "nobody" is not usable to run munin plugins under MacOS X you have to create an other account to do this, e.g. an account called "munin". Use the command "dscl" for this. As an alternative, you can try a * script to make this task more comfortable.

sudo dscl . create /Groups/munin PrimaryGroupID 4949
sudo dscl . create /Users/munin UniqueID 4949
sudo dscl . create /Users/munin PrimaryGroupID 4949
sudo dscl . create /Users/munin UserShell /bin/false
sudo dscl . create /Users/munin NFSHomeDirectory /var/run/munin
sudo dscl . create /Users/munin RealName Munin
sudo dscl . create /Groups/munin GroupMembership munin

Make sure /var/run/munin exists and is owned by munin:munin. If you want to run munin-node by hand to debug your config then set the UserShell? to /bin/bash.

You may prefer to use a UID/GID less than 500, to avoid it showing up in the login screen.

modify the configuration

Because the plugins can not executed by "nobody" edit the "Makefile.conf" and set PLUGINUSER to "munin". If you don;t like the settings for PREFIX, CONFDIR etc feel free to change them; but they are know to work just as they are!

install munin

This step in not different to the installation on other unix machines

node:/usr/src/munin/trunck# make install-common
node:/usr/src/munin/trunck# make install-node
node:/usr/src/munin/trunck# make install-node-plugins
node:/usr/src/munin/trunck# /usr/sbin/munin-node-configure --suggest --shell | sh

create a start-stop-script

There is a mechanism like at SystemV- or SMF-systems to start applications automaticly when the machine comes up (and stop applications when it stops). First create a new directory for your script, e.g. "Munin-Node": mkdir /System/Library/StartupItems/Munin?-Node Now create a executable script

#!/bin/sh
. /etc/rc.common
StartService()
{
mkdir -p /var/run/munin
/usr/sbin/munin-node
}
StopService()
{
kill ‘cat /var/run/munin.pid‘
}
RunService "$1"

Because there is no /etc/rc.d/ directory or any other construct to tell the operation system in which order services should be started you need a 2nd file in this directory with informations about the service to start. Call this file StartupParameters?.plist!

{
Description = "Munin Node for Mac OS X";
Provides = ("Munin-Node");
Requires = ("Network");
OrderPreference = "Late";
}

clean up

The next steps are trivial. First edit the configuration files, then reboot the Mac (or execute the start script by hand)

Munin-Node

Edit the munin-node.conf and configure the "allow" value to your munin-masters IP-address, e.g. to "allow 192\.168\.10\.3$"

Munin-Master

As with other nodes, you have to create a new entry in your "munin.conf" for the new machine.

[mac.home]
    address 192.168.10.1
    use_node_name yes

Using launchd

The current "official" way to run daemons in OSX is to use launchd. If you prefer to use this:

Edit munin-node.conf to disable backgrounding and to send log output to syslog:

log_level 4
log_file Sys::Syslog
pid_file /usr/local/munin/var/run/munin/munin-node.pid
#background 1
#setsid 1
user munin
group munin

Use the following plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>EnvironmentVariables</key>
        <dict>
                <key>LANG</key>
                <string>en_GB.UTF-8</string>
                <key>LC_ALL</key>
                <string>en_GB.UTF-8</string>
        </dict>
        <key>Label</key>
        <string>org.munin-monitoring.munin-node</string>
        <key>ProgramArguments</key>
        <array>
                  <string>/opt/munin/sbin/munin-node</string>
        </array>
        <key>WorkingDirectory</key>
        <string>/var/run/munin</string>
        <key>RunAtLoad</key>
        <true/>
</dict>
</plist>

If you don't want it to run automatically, omit the "RunAtLoad?" line and the subsequent "true" line. (You have to have both or neither or the plist will not be valid.)

Install and enable it as follows:

sudo cp org.munin-monitoring.munin-node.plist /Library/LaunchDaemons/.
sudo launchctl load /Library/LaunchDaemons

Consult /var/log/system.log for errors.

You can remove it as follows:

sudo launchctl unload /Library/LaunchDaemons/org.munin-monitoring.munin-node.plist
sudo rm -f /Library/LaunchDaemons/org.munin-monitoring.munin-node.plist

You can stop and start the daemon with the following commands:

sudo launchctl start org.munin-monitoring.munin-node
sudo launchctl stop org.munin-monitoring.munin-node
Last modified at 2015-07-20T13:21:49+02:00 Last modified on 2015-07-20T13:21:49+02:00