Admin Life Errors, Fixes, and Encounters


how to add a new munin node with freebsd

Here is what I did to add a new munin node in freebsd to an existing munin server.

cd /usr/ports/sysutils/munin-node/
make install clean

When asked about the logs, answer yes. We want munin to rotate the logs.

Would you like me to set up log rotation [y]?

After the munin install this is what we see and need to do.

Unless this file already existed, a sample configuration file
has been placed in /usr/local/etc/munin/munin-node.conf.

Please edit it according to your needs.


The Munin client will *not* be started automatically. To allow it
to start, put this line in /etc/rc.conf:


Then, it will be started on the next boot. If this line is already
present, the client will be started now. Otherwise, edit
/etc/rc.conf and execute this command:

/usr/local/etc/rc.d/munin-node start

Lets do the easy stuff first for munin.

vi /etc/rc.conf

add munin_node_enable="YES" somewhere in the file. I like to keep all the enable options together


The plugins directory in freebsd is empty, so for munin node to work we need to add symbolic links.

cd /usr/local/etc/munin/plugins

ln -s /usr/local/share/munin/plugins/cpu cpu
ln -s /usr/local/share/munin/plugins/df df
ln -s /usr/local/share/munin/plugins/df_inode df_inode
ln -s /usr/local/share/munin/plugins/if_errcoll_ if_errcoll_fxp0
ln -s /usr/local/share/munin/plugins/if_ if_fxp0
ln -s /usr/local/share/munin/plugins/load load
ln -s /usr/local/share/munin/plugins/memory memory
ln -s /usr/local/share/munin/plugins/netstat netstat
ln -s /usr/local/share/munin/plugins/ntp_offset ntp_offset
ln -s /usr/local/share/munin/plugins/open_files open_files
ln -s /usr/local/share/munin/plugins/processes processes
ln -s /usr/local/share/munin/plugins/sendmail_mailqueue sendmail_mailqueue
ln -s /usr/local/share/munin/plugins/sendmail_mailstats sendmail_mailstats
ln -s /usr/local/share/munin/plugins/sendmail_mailtraffic sendmail_mailtraffic
ln -s /usr/local/share/munin/plugins/swap swap
ln -s /usr/local/share/munin/plugins/vmstat vmstat

Next, lets look at the conf file

vi /usr/local/etc/munin/munin-node.conf

update the allow line to the IP address of the munin server

allow ^192\.168\.1\.105$

everything else is good, save and exit

for the munin server
add the IP address of that machine

vi /usr/local/etc/munin/munin.conf

Add this to the end of munin.conf

use_node_name yes
notify_alias server1

load.notify_alias load

df.notify_alias df

# /
df._dev_mirror_gm0s1a.warning :85
df._dev_mirror_gm0s1a.critical :90

# /tmp
df._dev_mirror_gm0s1e.warning :80
df._dev_mirror_gm0s1e.critical :90

# /usr
df._dev_mirror_gm0s1f.warning :80
df._dev_mirror_gm0s1f.critical :90

# /var
df._dev_mirror_gm0s1d.warning :80
df._dev_mirror_gm0s1d.critical :90

If you haven't done so you can start munin-node from

cd /usr/local/etc/rc.d/
./munin-node start

If munin node doesn't update after 5..10 minutes look at the munin main log to find any errors that you may have.

cd /var/log/munin-main
vi munin-update.log


Setup gmirror RAID 1 on FreeBSD

We are going to setup RAID 1 on FreeBSD 7.3 using gmirror. gmirror is a software based RAID system. I did this using FreeBSD 7.3 but this works with older versions of FreeBSD as well (i've done it as back as FreeBSD 6.2 . First things first, make sure you have the same hard drive size and if possible the same brand / model.

After installing freebsd but before existing the system installer

press ALT-F4 to be taken to the command prompt
type in csh to get a good shell


Create a mirror/duplex

gmirror label -v -b round-robin gm0 /dev/ad0

That's it, RAID 1 is now setup on the system
Now we tell the system to load it up everytime we boot up.

echo geom_mirror_load="YES" > /boot/loader.conf

make sure fstab uses raid, but first lets make a backup

cp /etc/fstab /etc/fstab.orig
vi /etc/fstab

Insert the word mirror after /dev and change ad to gm.
For example, /dev/ad0s1a becomes /dev/mirror/gm0s1a

double check that you didn't mistype anything or else the system may not boot up.

After that, ALT-F1 to switch back to the install interface. Reboot the machine.

When the system is done rebooting, we add the 2nd drive into the RAID array

gmirror insert gm0 /dev/ad2

To see what's happening with the RAID type in

gmirror list | more

To see the synchronizing status

gmirror status

Once the synchronizing is done, simply reboot and your done setting up RAID on FreeBSD