Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Install Nagios NRPE on FreeNAS

Read through the preamble to see what I tried first and why it didn’t work. Or jump ahead to the working install method.


I’ve been using FreeNAS for a couple of months now, starting with version 9 and later upgrading to version 11. While the experience so far has been great there are a few glaring omissions. First and foremost “monitoring”. There is just no convenient way to monitor the system externally.

Like many others, I use Nagios to monitor my systems, it is a fairly well known, mature and feature rich monitoring solution. Nagios is a straight forward client/server model. The Nagios server schedules checks, connects to the client server running NRPE. NRPE runs the scheduled check and responds with the result. Nagios also has a wide assortment of plugins available which can be downloaded as needed to monitor just about anything. It is a pretty good solution, except…

FreeNAS has NO, NONE, NADDA, ZILCH, ZERO means to install the NRPE client. Go ahead, search google, I’ll wait. Maybe try their forums or even the r/freenas subreddit. No luck eh? I know the frustration.

Maybe we missed something obvious? Lets check FreeNAS for an available plugin.

FreeNAS available plugins

Nope, nothing about Nagios or NRPE there. FreeNAS is based on FreeBSD, so perhaps we can install using pkg instead.

[email protected]:~ # pkg search nrpe
pkg: Repository local missing. 'pkg update' required
pkg: file:///usr/ports/packages/meta.txz: No such file or directory
pkg: file:///usr/ports/packages/packagesite.txz: No such file or directory
pkg: Repository local cannot be opened. 'pkg update' required

Hrm, okay, that didn’t work. But lets try the pkg update command as suggested.

[email protected]:~ # pkg update
Updating local repository catalogue...
pkg: file:///usr/ports/packages/meta.txz: No such file or directory
repository local has no meta file, using default settings
pkg: file:///usr/ports/packages/packagesite.txz: No such file or directory
Unable to update repository local

No luck either. It seems they just don’t want anyone using the pkg system. Thats annoying, but fair as they don’t want people messing with the system. I can understand that.

Besides there is another option available to us, we can build from source! And luckily Nagios has some excellent documentation available on doing just that. Lets get started by grabbing the source code.

[email protected]:~ # cd /tmp
[email protected]:/tmp # wget --no-check-certificate -O nrpe.tar.gz https://github.com/NagiosEnterprises/nrpe/archive/nrpe-3.2.0.tar.gz
--2017-08-06 12:06:05--  https://github.com/NagiosEnterprises/nrpe/archive/nrpe-3.2.0.tar.gz
Resolving github.com (github.com)...,
Connecting to github.com (github.com)||:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/NagiosEnterprises/nrpe/tar.gz/nrpe-3.2.0 [following]
--2017-08-06 12:06:06--  https://codeload.github.com/NagiosEnterprises/nrpe/tar.gz/nrpe-3.2.0
Resolving codeload.github.com (codeload.github.com)...,
Connecting to codeload.github.com (codeload.github.com)||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘nrpe.tar.gz’

nrpe.tar.gz                                            [   <=>                                                                                                           ] 505.64K  1.01MB/s    in 0.5s

2017-08-06 12:06:07 (1.01 MB/s) - ‘nrpe.tar.gz’ saved [517774]

Now we can extract it and change into the new directory.

[email protected]:/tmp # tar zxf nrpe.tar.gz
[email protected]:/tmp # cd /tmp/nrpe-nrpe-3.2.0/

So far so good, now lets run configure.

[email protected]:/tmp/nrpe-nrpe-3.2.0 # ./configure --enable-command-args
checking for a BSD-compatible install... /usr/bin/install -c
checking what the operating system is ... bsd
checking what the distribution type is ... freebsd
checking what init system is being used ... newbsd
checking what inetd is being used ... inetd (Not running)
checking for which paths to use ... default
checking for which init file to use ... newbsd-init
checking for which inetd files to use ... default-inetd
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in '/tmp/nrpe-nrpe-3.2.0':
configure: error: no acceptable C compiler found in $PATH
See 'config.log' for more details

…and no compiler, no gcc, no cc, nothing. Thanks FreeNAS! At this point we’ve exhausted all available options. Except one.

Building Nagios NRPE in a jail

That’s right, you read that right. To make this work, we’ll use a jail to compile and build Nagios NRPE and the Plugins from source. Then scp the resulting files to the FreeNAS server. It sounds complex, but its not, so lets get started.

Step 1) Create a new jail

Login to the UI of your FreeNAS system. Under Jails, click Add Jail, give it a name and click OK.

FreeNAS Add Jail

Step 2) Connect to your new jail

List the available jails on your FreeNAS system, then connect to the jail you created in step 1.

[email protected]:~ # jls
   JID  IP Address      Hostname                      Path
     1                  plex                          /mnt/vol1/jails/plex
     2                  build                         /mnt/vol1/jails/build
[email protected]:~ # jexec 2 tcsh
[email protected]:/ #

Step 3) Update your system

[email protected]:/ # pkg update
[email protected]:/ # pkg upgrade
[email protected]:/ # pkg install wget

Step 4) Build NRPE

Follow the Nagios build from source instructions documented here: https://support.nagios.com/kb/article.php?id=515#FreeBSD

Install prerequisites

pkg install -y wget autoconf automake gettext gcc openssl openssl-devel libmcrypt

Downloading the Source

cd ~/
wget --no-check-certificate -O nrpe.tar.gz https://github.com/NagiosEnterprises/nrpe/archive/nrpe-3.2.0.tar.gz
tar xzf nrpe.tar.gz


cd ~/nrpe-nrpe-3.2.0/
./configure --enable-command-args
make all

Create User And Group

make install-groups-users

Install Binaries

make install

Install Configuration Files

make install-config

Install Service / Daemon

make install-init

Step 5) Build Nagios Plugins

Follow the Nagios Plugins build from source instructions documented here: https://support.nagios.com/kb/article.php?id=569#FreeBSD

Prerequisites - Common

pkg install -y wget autoconf automake gettext gcc openssl-devel net-snmp p5-Net-SNMP-Util

Downloading the Source

cd ~/
wget --no-check-certificate -O nagios-plugins.tar.gz https://github.com/nagios-plugins/nagios-plugins/archive/release-2.2.1.tar.gz
tar zxf nagios-plugins.tar.gz

Compile + Install

cd ~/nagios-plugins-release-2.2.1/
make install

Step 6) Package Files

Create Directory Structure

mkdir -p ~/nrpe3-pkg/etc/rc.d
mkdir -p ~/nrpe3-pkg/usr/local/nagios/

Copy Files

cp /etc/rc.d/nrpe ~/nrpe3-pkg/etc/rc.d/
cp -R /usr/local/nagios/* ~/nrpe3-pkg/usr/local/nagios/

Package the Files

cd ~/
tar zcvf nrpe3.tar.gz nrpe3-pkg/

Step 7) Copy the nrpe3.tar.gz file to FreeNAS

scp ~/nrpe3.tar.gz [email protected]:~/

Step 8) Install on FreeNAS

Extract Files

ssh -l root freenas
cd ~/
tar zxf nrpe3.tar.gz

Download Install Script

Configure and install NRPE files and plugins, with the below install.sh script.

cd ~/nrpe3-pkg
wget https://gist.github.com/mikejsutherland/41cccb888a7936c7c0fed95ae7fbfb20/raw/4bce902ea6dde4c8d35bfe8f08e341f8676f4e07/install.sh

Run install.sh

chmod 755 install.sh

Step 9) Start NRPE

service nrpe start

Step 10) Test it

/usr/local/nagios/libexec/check_nrpe -H
NRPE v3.2.0

Step 11) Configure NRPE

Thats it, NRPE should now be running on FreeNAS. Configure as necessary by editing “/usr/local/nagios/etc/nrpe.cfg”.


With a little extra work, Nagios NRPE can be made to run on FreeNAS. FreeNAS available plugins