Tested on:
NAS4Free 9.1.0.1 - Sandstorm (rev 847 & 943)
Platform x64-FULL on a VirtualBox VM on HP Microserver N40L (AMD64)
Tested and Working on Apache 2.2 without additional configuration
This guide will detail how to install Munin in a jail to monitor network devices. This will require no previous experience or knowledge of Munin or Apache and will consist of as minimal configuration as possible to get you started. There will always be other, better ways in doing most of this however the methods outlined here have worked for me and should minimise any confusion/frustration.
This guide assumes you have a system running a default installation of N4F with the IP address 192.168.1.250. This server has a new jail called 'munin' with an IP address of 192.168.1.251, has fully working Internet access, SSH and a file editor (Nano).
Before I begin, I give credit to the following which this guide is based on:
Monitor Systems Using Munin
Munin Monitoring
Munin works in a master/node configuration whereby Munin-Master is installed on the system which will do the monitoring and Munin-Node is installed on the system(s) which need to be monitored. In this example, the N4F host 192.168.1.250 will be the system we want to monitor - this is using the FULL version of N4F, not Embedded.
To start with, SSH to your server and enter one of the two commands below depending on whether your system is AMD or Intel based:
Code: Select all
setenv PACKAGESITE "ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-current/Latest/"
setenv PACKAGESITE "ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9-current/Latest/"If you want to install the FreeBSD Ports Collection, install it with the following commands:
Code: Select all
portsnap fetch extractCode: Select all
portsnap fetch updateCode: Select all
cd /usr/ports/sysutils/munin-node/
make install cleanCode: Select all
pkg install sysutils/munin-nodeCode: Select all
nano /usr/local/etc/munin/munin-node.confCode: Select all
allow ^127\.0\.0\.1$
allow ^::1$Code: Select all
allow ^192\.168\.1\.251$Code: Select all
allow ^127\.0\.0\.1$
allow ^::1$
allow ^192\.168\.1\.251$Code: Select all
/usr/local/sbin/munin-node-configure --shell | sh -xCode: Select all
/usr/local/etc/rc.d/munin-node onestartOnce the Munin-Node installation is complete, list the jails so we can set up Munin-Master:
Code: Select all
Welcome to NAS4Free!
nas4free: ~ # jls
JID IP Address Hostname Path
1 192.168.1.251 munin.local /jail/muninCode: Select all
nas4free: ~ # jexec 1 csh
root@munin:/ #Code: Select all
root@munin:/ # cat /etc/hosts
::1 localhost localhost.local
127.0.0.1 localhost localhost.local
192.168.1.250 nas4free nasfree.local
192.168.1.251 munin munin.localCode: Select all
echo '192.168.1.250 nasfree nas4free.local' >> /etc/hosts
echo '192.168.1.251 munin munin.local' >> /etc/hostsEnter one of the two commands below depending on whether your system is AMD or Intel based:
Code: Select all
setenv PACKAGESITE "ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-current/Latest/"
setenv PACKAGESITE "ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-9-current/Latest/"Code: Select all
portsnap fetch extractCode: Select all
portsnap fetch updateCode: Select all
cd /usr/ports/www/apache22
make install cleanCode: Select all
pkg install www/apache22Code: Select all
echo 'apache22_enable="YES"' >> /etc/rc.confCode: Select all
cd /usr/ports/systils/munin-master/
make install cleanCode: Select all
pkg install sysutils/munin-masterCode: Select all
nano /usr/local/etc/munin/munin.confCode: Select all
# a simple host tree
[munin.local]
address 127.0.0.1
use_node_name yesCode: Select all
[nasfree.local]
address 192.168.1.250
use_node_name yesCode: Select all
# a simple host tree
[munin.local]
address 127.0.0.1
use_node_name yes
[nasfree.local]
address 192.168.1.250
use_node_name yesCode: Select all
touch /usr/local/etc/apache22/Includes/munin.conf
nano /usr/local/etc/apache22/Includes/munin.confCode: Select all
Alias /munin "/usr/local/www/munin"
<Directory /usr/local/www/munin>
Options none
AllowOverride Limit
Order Deny,Allow
Deny from all
Allow from all
</Directory>Code: Select all
rm -rf /usr/local/www/munin/.htaccessCode: Select all
/usr/local/etc/rc.d/apache22 configtestCode: Select all
/usr/local/etc/rc.d/apache22 startClick on the N4F host and a list of graphs will be displayed on a daily/weekly/monthly/yearly basis:
And that's it - Munin will now be graphing everything for your N4F host!
Munin is very customisable so it may take a while to configure it as you want it, however there's plenty of additional plugins etc. on Google should you wish to.
I hope some of you find this guide useful, any corrections or recommendations are welcome.
