NRPE Install Fails on Ubuntu 16.04

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
cybergene
Posts: 92
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

NRPE Install Fails on Ubuntu 16.04

Post by cybergene »

I'm installing NRPE V3.0.1 on Ubuntu 16.04 following steps from 'NRPE - How To Install NRPE v3 From Source': https://support.nagios.com/kb/article.php?id=515
The machine is:

Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04

Codename: xenial

When I run this command:
Ubuntu 15.x, 16.x

Code: Select all

sudo make install-init
I get this error:

Code: Select all

o init file to install
Makefile:93: recipe for target 'install-init' failed
make: *** [install-init] Error 1

The configuration seems okay:

Code: Select all

sudo ./configure --enable-command-args --with-ssl-lib=/usr/lib/x86_64-linux-gnu/
Results in:

Code: Select all

.....
*** Configuration summary for nrpe 3.0.1 09-08-2016 ***:

 General Options:
 -------------------------
 NRPE port:    5666
 NRPE user:    nagios
 NRPE group:   nagios
 Nagios user:  nagios
 Nagios group: nagios

Review the options above for accuracy.  If they look okay,
type 'make all' to compile the NRPE daemon and client
or type 'make' to get a list of make options.
If you need more information please let me know.
Any help is appreciated.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: NRPE Install Fails on Ubuntu 16.04

Post by dwhitfield »

What's the output of sestatus? It's fine if it's not installed. Do you have any modified sudoers?

What's the output of ls -la /lib/systemd/? I'm thinking there is some sort of permissions issue going on. Are you able to give the root user shell access and try with that user?

Last thing. What's the output of uname -a?

I just tried to install on my system and did not run into any issues. Of course, I am running as root, though I did run the sudo commands just to be sure.

Code: Select all

root@localhost:/tmp/nrpe-3.0.1# cat /etc/*lease
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
NAME="Ubuntu"
VERSION="16.04.2 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.2 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
cybergene
Posts: 92
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: NRPE Install Fails on Ubuntu 16.04

Post by cybergene »

Output of sestatus

Code: Select all

The program 'sestatus' is currently not installed. You can install it by typing:
sudo apt install policycoreutils
Output of ls -la /lib/systemd/

Code: Select all

total 8432
drwxr-xr-x  8 root root    4096 Jan 23 17:03 .
drwxr-xr-x 25 root root    4096 Mar 22 13:14 ..
drwxr-xr-x  2 root root    4096 Jan 23 17:03 network
drwxr-xr-x 26 root root   36864 Mar 22 17:03 system
-rwxr-xr-x  1 root root 1577232 Jan 18 22:04 systemd
-rwxr-xr-x  1 root root   14600 Jan 18 22:04 systemd-ac-power
-rwxr-xr-x  1 root root   55744 Jan 18 22:04 systemd-activate
-rwxr-xr-x  1 root root   92752 Jan 18 22:04 systemd-backlight
-rwxr-xr-x  1 root root   47680 Jan 18 22:04 systemd-binfmt
-rwxr-xr-x  1 root root  105088 Jan 18 22:04 systemd-bootchart
-rwxr-xr-x  1 root root  359632 Jan 18 22:04 systemd-bus-proxyd
-rwxr-xr-x  1 root root  273616 Jan 18 22:04 systemd-cgroups-agent
-rwxr-xr-x  1 root root   92752 Jan 18 22:04 systemd-cryptsetup
-rwxr-xr-x  1 root root  307224 Jan 18 22:04 systemd-fsck
-rwxr-xr-x  1 root root   76376 Jan 18 22:04 systemd-fsckd
-rwxr-xr-x  1 root root   31152 Jan 18 22:04 systemd-hibernate-resume
-rwxr-xr-x  1 root root  339152 Jan 18 22:04 systemd-hostnamed
-rwxr-xr-x  1 root root  281808 Jan 18 22:04 systemd-initctl
-rwxr-xr-x  1 root root  326224 Jan 18 22:04 systemd-journald
-rwxr-xr-x  1 root root  347344 Jan 18 22:04 systemd-localed
-rwxr-xr-x  1 root root  618520 Jan 18 22:04 systemd-logind
-rwxr-xr-x  1 root root   51792 Jan 18 22:04 systemd-modules-load
-rwxr-xr-x  1 root root  843008 Jan 18 22:04 systemd-networkd
-rwxr-xr-x  1 root root  125520 Jan 18 22:04 systemd-networkd-wait-online
-rwxr-xr-x  1 root root   35320 Jan 18 22:04 systemd-quotacheck
-rwxr-xr-x  1 root root   35256 Jan 18 22:04 systemd-random-seed
-rwxr-xr-x  1 root root   51800 Jan 18 22:04 systemd-remount-fs
-rwxr-xr-x  1 root root   31152 Jan 18 22:04 systemd-reply-password
-rwxr-xr-x  1 root root  671760 Jan 18 22:04 systemd-resolved
-rwxr-xr-x  1 root root   92752 Jan 18 22:04 systemd-rfkill
-rwxr-xr-x  1 root root  146032 Jan 18 22:04 systemd-shutdown
-rwxr-xr-x  1 root root   72272 Jan 18 22:04 systemd-sleep
-rwxr-xr-x  1 root root   92752 Jan 18 22:04 systemd-socket-proxyd
-rwxr-xr-x  1 root root   51800 Jan 18 22:04 systemd-sysctl
-rwxr-xr-x  1 root root    1324 Jan 12 14:08 systemd-sysv-install
-rwxr-xr-x  1 root root  340016 Jan 18 22:04 systemd-timedated
-rwxr-xr-x  1 root root  141904 Jan 18 22:04 systemd-timesyncd
-rwxr-xr-x  1 root root  453240 Jan 18 22:04 systemd-udevd
-rwxr-xr-x  1 root root  281808 Jan 18 22:04 systemd-update-utmp
-rwxr-xr-x  1 root root   35256 Jan 18 22:04 systemd-user-sessions
drwxr-xr-x  2 root root    4096 Mar 17 16:00 system-generators
drwxr-xr-x  2 root root    4096 Jan 23 17:03 system-preset
drwxr-xr-x  2 root root    4096 Oct  5 00:12 system-shutdown
drwxr-xr-x  2 root root    4096 Oct 25 15:57 system-sleep

Output of uname -a

Code: Select all

Linux ip-xxx-xx-xx-xx 4.4.0-45-generic #66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
I don't have a modified sudoers.
Here is he output for : cat /etc/*lease

Code: Select all

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
NAME="Ubuntu"
VERSION="16.04.2 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.2 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: NRPE Install Fails on Ubuntu 16.04

Post by mcapra »

Hmm, I haven't been able to replicate this so far. Here's my history:

Code: Select all

   38  apt-get install -y autoconf gcc libc6 libmcrypt-dev make libssl-dev wget
   39  cd /tmp
   40  wget --no-check-certificate -O nrpe.tar.gz https://github.com/NagiosEnterprises/nrpe/archive/3.0.1.tar.gz
   41  tar xzf nrpe.tar.gz
   42  cd /tmp/nrpe-3.0.1/
   43  ./configure --enable-command-args
   44  ./configure --enable-command-args --with-ssl-lib=/usr/lib/x86_64-linux-gnu/
   45  make all
   46  make install
   47  make install-groups-users
   48  make install
   49  make install-config
   50  sh -c "echo >> /etc/services"
   51  sh -c "sudo echo '# Nagios services' >> /etc/services"
   52  sh -c "sudo echo 'nrpe    5666/tcp' >> /etc/services"
   53  make install-init
   54  history
Here's my make install-init output:

Code: Select all

root@localhost:/tmp/nrpe-3.0.1# make install-init
/usr/bin/install -c -m 644 startup/default-service /lib/systemd/system/nrpe.service

That particular recipe isn't doing anything very ambitious. Do you know if there's systemd restrictions on this machine?
Former Nagios employee
https://www.mcapra.com/
cybergene
Posts: 92
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: NRPE Install Fails on Ubuntu 16.04

Post by cybergene »

No, there is no restrictions. I tried re-installing it again, same problem.
I double checked the permissions, no limited permission either.

Do we need xinetd for nrpe on this box?
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: NRPE Install Fails on Ubuntu 16.04

Post by avandemore »

Can you attach the Makefile your system generated?
Previous Nagios employee
cybergene
Posts: 92
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: NRPE Install Fails on Ubuntu 16.04

Post by cybergene »

Here is the Makefile

Code: Select all

###############################
# Makefile for NRPE
#
# Last Modified: 03-14-2007
###############################


# Source code directories
SRC_BASE=./src/
SRC_INCLUDE=./include/

# Mainly used for rpmbuild
# DESTDIR=

CC=gcc
CFLAGS=-g -O2 -I/usr/include/openssl -DHAVE_CONFIG_H
LDFLAGS= -L/usr/lib/x86_64-linux-gnu/  -lssl -lcrypto

INSTALL=/usr/bin/install -c
GREP=/bin/grep
EGREP=/bin/grep -E

prefix=$(DESTDIR)/usr/local/nagios
exec_prefix=$(DESTDIR)/usr/local/nagios
CFGDIR=$(DESTDIR)/usr/local/nagios/etc
BINDIR=$(DESTDIR)/usr/local/nagios/bin
SBINDIR=$(DESTDIR)/usr/local/nagios/bin
LIBEXECDIR=$(DESTDIR)/usr/local/nagios/libexec
NAGIOS_INSTALL_OPTS=-o nagios -g nagios
NRPE_INSTALL_OPTS=-o nagios -g nagios
OPSYS=linux
DIST=debian
NRPE_USER=nagios
NRPE_GROUP=nagios
NAGIOS_USER=nagios
NAGIOS_GROUP=nagios

INIT_TYPE=unknown
INIT_DIR=$(DESTDIR)unknown
INIT_OPTS=-o root -g root
INIT_FILE=unknown
INETD_TYPE=unknown
INETD_DIR=$(DESTDIR)unknown
INETD_FILE=unknown
SRC_INETD=unknown
SRC_INIT=unknown


default:
        @echo;\
        echo Please enter 'make [option]' where [option] is one of:;\
        echo;\
        echo "     all                  builds nrpe and check_nrpe";\
        echo "     nrpe                 builds nrpe only";\
        echo "     check_nrpe           builds check_nrpe only";\
        echo "     install-groups-users add the users and groups if they do not exist";\
        echo "     install              install nrpe and check_nrpe";\
        echo "     install-plugin       install the check_nrpe plugin";\
        echo "     install-daemon       install the nrpe daemon";\
        echo "     install-config       install the nrpe configuration file";\
        echo "     install-inetd        install the startup files for inetd, launchd, etc.";\
        echo "     install-init         install the startup files for init, systemd, etc.";\
        echo

all:
        cd $(SRC_BASE); $(MAKE)

        @echo "";\
        echo "*** Compile finished ***";\
        echo "";\
        echo "You can now continue with the installation or upgrade process.";\
        echo "";\
        echo "Read the PDF documentation (NRPE.pdf) for information on the next";\
        echo "steps you should take to complete the installation or upgrade.";\
        echo ""

nrpe:
        cd $(SRC_BASE); $(MAKE)

check_nrpe:
        cd $(SRC_BASE); $(MAKE)

install-plugin:
        cd $(SRC_BASE); $(MAKE) $@

install-daemon:
        cd $(SRC_BASE); $(MAKE) $@

install:
        cd $(SRC_BASE); $(MAKE) $@

install-init:
        @if test $(SRC_INIT) = unknown; then \
                echo No init file to install; \
				 exit 1; \
        fi
        @if test $(INIT_TYPE) = upstart; then\
                echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
                $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
                echo initctl reload-configuration; \
                initctl reload-configuration; \
        elif test $(INIT_TYPE) = systemd; then\
                echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
                $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
        elif test $(INIT_TYPE) = smf10 -o $(INIT_TYPE) = smf11; then \
                echo $(INSTALL) -m 775 -g sys -d $(INIT_DIR);\
                $(INSTALL) -m 775 -g sys -d $(INIT_DIR);\
                echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
                $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
                echo svccfg import $(INIT_DIR)/$(INIT_FILE); \
                svccfg import $(INIT_DIR)/$(INIT_FILE); \
                echo "*** Run 'svcadm enable nrpe' to start it"; \
        else\
                echo $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
                $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
                if test $(INIT_TYPE) = newbsd; then\
                        if test $(DIST) = openbsd; then\
                                echo "# nrpe=NO" >> /etc/rc.conf;\
                                echo "nrpe=\"-d -c $(CFGDIR)/nrpe.cfg\"" >> /etc/rc.conf;\
                                echo "Make sure to enable the nrpe daemon";\
                        else\
                                echo "nrpe=YES" >> /etc/rc.conf;\
                                echo "nrpe_configfile=$(CFGDIR)/nrpe.cfg" >> /etc/rc.conf;\
                        fi;\
                elif test $(INIT_TYPE) = launchd; then\
                        launchctl load $(INIT_DIR)/$(INIT_FILE); \
                else\
                        if test -f /sbin/chkconfig ; then \
                            /sbin/chkconfig nrpe on;\
                        else\
                                echo "Make sure to enable the nrpe daemon";\
                        fi;\
                fi;\
        fi

		install-inetd:
        @if test $(SRC_INETD) = unknown; then \
                echo No inetd file to install; \
                exit 1; \
        fi
        @if test $(INETD_TYPE) = inetd; then \
                $(EGREP) -q "^\W*nrpe\s+" $(INETD_DIR)/$(INETD_FILE) 2>/dev/null || \
                   cat startup/$(SRC_INETD) >> $(INETD_DIR)/$(INETD_FILE); \
        elif test $(INETD_TYPE) = systemd; then \
                SRC_INETD_FILE=`echo "$(SRC_INETD)" | sed -e 's/socket/socket-svc/'`; \
                echo $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
                $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
        elif test $(INETD_TYPE) = smf10 -o $(INETD_TYPE) = smf11; then \
                echo $(INSTALL) -m 775 -g sys -d $(INETD_DIR);\
                $(INSTALL) -m 775 -g sys -d $(INETD_DIR);\
                echo $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
                $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
                $(INSTALL) -m 775 -d $(INETD_DIR);\
                echo svccfg import $(INETD_DIR)/$(INETD_FILE); \
                svccfg import $(INETD_DIR)/$(INETD_FILE); \
                echo "*** Run 'svcadm enable nrpe' to start it"; \
        elif test $(INIT_TYPE) = launchd; then\
                $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
                launchctl load $(INETD_DIR)/$(INETD_FILE); \
        else\
                echo $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
                $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
        fi
        @$(EGREP) -q "^nrpe[\t ]+5666/tcp" /etc/services || \
                echo "***** MAKE SURE 'nrpe 5666/tcp' IS IN YOUR /etc/services FILE"

install-config:
        $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(CFGDIR)
        $(INSTALL) -m 644 $(NRPE_INSTALL_OPTS) sample-config/nrpe.cfg $(CFGDIR)

install-groups-users:
        @macros/add_group_user $(DIST) $(NAGIOS_USER) $(NAGIOS_GROUP)
        @if test "$(NAGIOS_USER)" != "$(NRPE_USER)" -o "$(NAGIOS_GROUP)" != "$(NRPE_GROUP)"; then\
                macros/add_group_user $(DIST) $(NRPE_USER) $(NRPE_GROUP);\
        fi

clean:
        cd $(SRC_BASE); $(MAKE) $@; cd ..
        rm -f core
        rm -f *~ */*~

distclean: clean
        cd $(SRC_BASE); $(MAKE) $@; cd ..
        rm -rf autom4te.cache
        rm -f config.log config.status config.cache sample-config/nrpe.cfg $(SRC_INCLUDE)/config.h
        rm -f startup/bsd-init startup/debian-init startup/default-init startup/default-inetd
        rm -f startup/default-service startup/default-socket startup/default-socket-svc
        rm -f startup/default-xinetd startup/mac-init.plist startup/mac-inetd.plist
        rm -f startup/newbsd-init startup/openbsd-init startup/openrc-conf
        rm -f startup/openrc-init startup/rh-upstart-init startup/solaris-init.xml
        rm -f startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init
        rm -f nrpe.spec uninstall include/common.h
        rm -f Makefile

devclean: distclean

avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: NRPE Install Fails on Ubuntu 16.04

Post by avandemore »

xinitd *shouldn't* be needed, but it might be a work-around.
Is this a standard install eg straight from Ubuntu ISO eg http://releases.ubuntu.com/16.04/ubuntu ... -amd64.img ? Or have there been further mods done to it post-install?
Previous Nagios employee
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NRPE Install Fails on Ubuntu 16.04

Post by ssax »

Please try running this from the installtion directory and send us the full output:

Code: Select all

sudo /usr/bin/install -c -m 644 startup/default-service /lib/systemd/system/nrpe.service
Then no need to make install-init.
cybergene
Posts: 92
Joined: Wed Aug 10, 2016 7:38 am
Location: Ottawa, Ontario, Canada

Re: NRPE Install Fails on Ubuntu 16.04

Post by cybergene »

avandemore wrote:xinitd *shouldn't* be needed, but it might be a work-around.
Is this a standard install eg straight from Ubuntu ISO eg http://releases.ubuntu.com/16.04/ubuntu ... -amd64.img ? Or have there been further mods done to it post-install?
No further mods.
ssax wrote:Please try running this from the installtion directory and send us the full output:

Code: Select all

sudo /usr/bin/install -c -m 644 startup/default-service /lib/systemd/system/nrpe.service
Then no need to make install-init.
There is no output when I run the command above:

Code: Select all

ubuntu@ip-xxx-xx-xx.xx:~/nrpe-downloads/nrpe-3.0.1$ sudo /usr/bin/install -c -m 644 startup/default-service /lib/systemd/system/nrpe.service
ubuntu@ip-xxx-xx-xx-xx:~/nrpe-downloads/nrpe-3.0.1$
It says nrpe is unrecognized service :

Code: Select all

ubuntu@ip-xx-xx-xx-xx:/usr/local/nagios/etc$ sudo service nrpe start
nrpe: unrecognized service
When I test it, I get this:

Code: Select all

ubuntu@ip-xxx-xx-xx-xx:/usr/local/nagios/etc$ /usr/local/nagios/libexec/check_nrpe -V

NRPE Plugin for Nagios
Copyright (c) 1999-2008 Ethan Galstad (nagios@nagios.org)
Version: 3.0.1
Last Modified: 09-08-2016
License: GPL v2 with exemptions (-l for more info)
SSL/TLS Available: OpenSSL 0.9.6 or higher required

Locked