Welcome to It-Slav.Net blog
Peter Andersson
peter@it-slav.net

I've already got a female to worry about. Her name is the Enterprise.
-- Kirk, "The Corbomite Maneuver", stardate 1514.0

Background

My old NAS built on top of CentOS has some performence issues and the disks are quit old now. The hardware is leftovers that is approx 8 years old and not highend at that time either. The disks age has worried my for a time and I would like to have higher redunduncy with raid1/mirrored disks.

After some research I decided to run my new NAS on FreeNAS, which has all the features I use, like: CIFS, NFS, FTP, SSH, Rsync, Unison, iSCSI and also easy administration and disk management.

This article will describe how I did setup Nagios or op5 Monitoring on my FreeNAS system. I assume basic knowledge of Nagios or op5 Monitor.

 

Installing nrpe

Nrpe is the agent that nagios and op5 Monitor uses to monitor a system from the inside.

From the webgui add group nagios and user nagios. User nagios should be a meber of group nagios.

 freenas:~# pkg_add -r nrpe2
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.3-release/Latest/nrpe2.tbz... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.3-release/All/perl-5.10.1.tbz... Done.
Removing stale symlinks from /usr/bin...
    Skipping /usr/bin/perl
    Skipping /usr/bin/perl5
Done.
Creating various symlinks in /usr/bin...
    Symlinking /usr/local/bin/perl5.10.1 to /usr/bin/perl
    Symlinking /usr/local/bin/perl5.10.1 to /usr/bin/perl5
Done.
cd: can't cd to /usr/include
Cleaning up /etc/make.conf... Done.
Spamming /etc/make.conf... Done.
Cleaning up /etc/manpath.config... Done.
Spamming /etc/manpath.config... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.3-release/All/libiconv-1.13.1_1.tbz... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.3-release/All/gettext-0.17_1.tbz... Done.
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.3-release/All/nagios-plugins-1.4.14,1.tbz... Done.
You already have a "nagios" group, so I will use it.
You already have a "nagios" user, so I will use it.

**********************************************************************

 Enable NRPE in /etc/rc.conf with the following line:

   nrpe2_enable="YES"

 A sample configuration is available in /usr/local/etc/nrpe.cfg-sample.
 Copy to nrpe.cfg where required and edit to suit your needs.

**********************************************************************
 

freenas:~# cp /usr/local/etc/nrpe.cfg-sample /etc/nrpe.cfg

I changed the allowed_hosts line and added my op5 Monitor host.

 
Unfortunatly the instructions to autostart nrpe do not work, my guess is that FreeNAS is not 100% FreeBSD compatible.
I modified /etc/rc and addded in the end of the file:
 
#Added by peter@it-slav.net 20101114
echo 'nrpe'
/usr/local/sbin/nrpe2 -c /etc/nrpe.cfg -d
#End peter@it-slav.net
 
# Let the PHP functions know we've finished booting
BOOTING=0
 
 
Reboot the FreeNAS system.
 
From the op5 Monitor/Nagios host run:
# ./check_nrpe -H fnas -c check_load
OK - load average: 0.72, 0.85, 0.81|load1=0.721;15.000;30.000;0; load5=0.847;10.000;25.000;0; load15=0.808;5.000;20.000;0; 

 

So the nagios agent works.

 

 

 

Links

  • op5, an Enterprise Monitor product company
  • op5 Monitor, Enterprise Monitoring based on opensource
  • Nagios, an excellent opensource monitor tool
  • FreeNAS, very capable NAS based on FreeBSD
 

 

 


4 Responses to “Monitor FreeNAS with op5 Monitor or Nagios”

  1. tt Says:

    You need to put the cfg file in /conf/base/etc/nrpe.cfg and make rc.conf changes in the same directory for them to survive reboot.

  2. tt Says:

    Furthermore –
    cp /usr/local/etc/rc.d/nrpe2 /conf/base/etc/rc.d/nrpe2
    chmod +x /conf/base/etc/rc.d/nrpe2
    Add to /conf/base/etc/rc.conf:
    nrpe2_enable="YES"
     
    nrpe2_configfile="/etc/nrpe.cfg"
     

  3. tt Says:

    ………….
    Fix pid dir for /etc/rc.d/nrpe2 status showing as not running even if it is:
     
    mkdir /conf/base/var/spool/nagios
    chown nagios:nagios /conf/base/var/spool/nagios

  4. peter Says:

    Ok, thanks

    /Peter

Leave a Reply





Book reviews
FreePBX 2.5
Powerful Telephony Solutions






Asterisk 1.6
Build a feature rich telephony system with Asterisk






Learning NAGIOS 3.0





Cacti 0.8 Network Monitoring,
Monitor your network with ease!