[HOWTO] Monitor NAS4Free with Munin Inside Jail
Posted: 23 Mar 2014 23:57
[HOWTO] Monitor NAS4Free with Munin Inside Jail
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:
Next, the necessary packages or ports need to be installed, this guide will outline the procedure for both.
If you want to install the FreeBSD Ports Collection, install it with the following commands:
If it's already installed, make sure it's up to date:
Next, install the Munin-Node port:
If you're using packages:
Next, edit the Munin-Node configuration file to allow Munin-Master to access it:
Scroll down to the line which says:
And add:
So it should now show as:
Once complete, save and exit the file. The next step is for Munin-Node to configure itself:
This command will list all of the plugins which Munin-Node will use - plugins are what make Munin as customisable as it is. To start the Munin-Node program, enter the following:
To ensure it starts everytime the host is restarted, add 'munin_node_enable="YES"' on the N4F GUI (System -> Advanced -> rc.conf) as per this screenshot:
Once the Munin-Node installation is complete, list the jails so we can set up Munin-Master:
Then enter the jail:
Once in the jail, check the hosts file and make sure it matches how you've setup your host and jail:
If it doesn't look like the above, enter the following
Next, we need to install the necessary packages or ports within the jail in the same way as we did for the N4F host.
Enter one of the two commands below depending on whether your system is AMD or Intel based:
If you want to use the FreeBSD Ports Collection, install it with the following commands:
If it's already installed, make sure it's up to date:
Next, install the Apache 2.2 port (this may take a while and install a lot of dependancies):
If you're using packages:
To ensure Apache starts automatically, enter the following:
Once that's complete, install Munin-master (same note applies as the Apache install above):
And with packages:
Once these are installed by either method, we need to edit the Munin-Master configuration file to tell it about the system(s) it will need to monitor:
Scroll down to the line which says:
And add the following below it:
So it should look like this by the time you've finished:
Once you've saved and exited the file, we need to tell Apache about Munin, so enter the two commands below:
And paste the following into it before saving and exiting:
You'll also need to delete the following file before starting Apache:
Once you get to this point, all you need to do is to sanity check the Apache config to check for typos:
If it responds with 'Syntax OK', you'll be able to start it:
To test Munin, enter http://192.168.1.251/munin into your browser and the Overview page should show up.
Click 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.
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.