Page 1 of 2

Install NRPE 3.2.1 on CentOS 7 server

Posted: Mon Nov 20, 2017 12:04 pm
by bsivavani
Hi,

We would like to install NRPE 3.2.1 on CentOS 7 server, but with below conditions

1. NRPE should run with out running under xinetd
2. NRPE and Plugin files should install from rpm package, but not from the tar file (nrpe-3.2.1.tar.gz)

Kindly advice on installation procedure ?

Re: Install NRPE 3.2.1 on CentOS 7 server

Posted: Mon Nov 20, 2017 1:44 pm
by dwasswa
Hi @bsivavani,

Unfortunately, Nagios does not have rpm packages for NRPE 3.2.1.

This means that you will have to create your own; to do that, please follow the steps in this link...How_to_create_an_RPM_package

As for the plugin files, please run the following command...yum install nagios-plugins-all -y

Lastly, your question:
NRPE should run without running under xinetd


Please follow this kb article...How To Install NRPE v3 From Source

Please follow the instructions above and let me know if that solves your issue.

Re: Install NRPE 3.2.1 on CentOS 7 server

Posted: Tue Nov 21, 2017 12:41 am
by bsivavani
Hi,

Thanks for the update.

I have installed NRPE 3.2.0 using below rpm file
http://dl.fedoraproject.org/pub/epel/7/ ... noarch.rpm

And installed nagios plugin files using YUM
yum install nagios-plugins-all -y

But while testing the cpu usage from Nagios server, we are receiving below error

[nagios@nagiosserver ~]$ /usr/local/nagios/libexec/check_nrpe -H Remoteserver -c check_cpu_stats1 -a "-Iw 20 -Ic 10"
NRPE: Unable to read output
[nagios@nagiosserver ~]$

Attached nrpe.cfg file.

Kindly advice ?

Re: Install NRPE 3.2.1 on CentOS 7 server

Posted: Tue Nov 21, 2017 10:31 am
by kyang
Let's try seeing if check_nrpe works locally and remotely.

Please run this from the command line and show us the output.

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <XI IP>

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H <remoteHostIP>
Just to be sure, this is what I see on my XI for this plugin.

Code: Select all

./check_cpu_stats.sh --help

check_cpu_stats.sh Revision 1.3.1 - CPU Utilization check script for Nagios

Usage: check_cpu_utilization.sh -w <warning value in % for iowait>

                -w  Warning level for cpu iowait
                -h  Show this page

Usage: check_cpu_stats.sh
Usage: check_cpu_stats.sh --help
Usage: check_cpu_stats.sh -w <warning>

Code: Select all

./check_cpu_stats.sh -w 60
CPU STATISTICS OK: user=1.32% system=0.71% iowait=0.10% idle=97.86% | user=1.32% system=0.0% iowait=0.0%;60;100 idle=97.86%

Does the command work if you run it on your machine? Can you show us the output?

Code: Select all

/usr/local/nagios/libexec/check_cpu_stats -lw 20 -lc 10 

Re: Install NRPE 3.2.1 on CentOS 7 server

Posted: Wed Nov 22, 2017 7:21 am
by bsivavani
Hi,

We are able to install nrpe using rpm and run the plugin remotely.

We are seeing nrpe is failed when we check the status from systemctl

[root@s93tl3101 nagios]# systemctl status nrpe
● nrpe.service - Nagios Remote Program Executor
Loaded: loaded (/usr/lib/systemd/system/nrpe.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2017-11-22 12:03:29 CET; 3min 20s ago
Docs: http://www.nagios.org/documentation
Process: 5407 ExecStart=/usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d $NRPE_SSL_OPT (code=exited, status=0/SUCCESS)
Main PID: 5408 (code=exited, status=2)

Nov 22 12:03:29 s93tl3101 systemd[1]: Starting Nagios Remote Program Executor...
Nov 22 12:03:29 s93tl3101 systemd[1]: Started Nagios Remote Program Executor.
Nov 22 12:03:29 s93tl3101 systemd[1]: nrpe.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 22 12:03:29 s93tl3101 systemd[1]: Unit nrpe.service entered failed state.
Nov 22 12:03:29 s93tl3101 systemd[1]: nrpe.service failed.
[root@s93tl3101 nagios]#

But when we check for nrpe using ps command it is running.
[root@s93tl3101 nagios]# ps -ef | grep nrpe
nrpe 6102 1 0 12:06 ? 00:00:00 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d
root 9872 9068 0 13:15 pts/0 00:00:00 grep --color=auto nrpe
[root@s93tl3101 nagios]#

Kindly advice ?

Re: Install NRPE 3.2.1 on CentOS 7 server

Posted: Wed Nov 22, 2017 12:14 pm
by lmiltchev
Can you show us the "/etc/systemd/system/multi-user.target.wants/nrpe.service" and "/usr/local/nagios/etc/nrpe.cfg" file? This should help us identify why nrpe service is failing to start (status=2/INVALIDARGUMENT).

Re: Install NRPE 3.2.1 on CentOS 7 server

Posted: Thu Nov 23, 2017 3:54 am
by bsivavani
Please find requested output

[root@s930l3087 plugins]# ls -l /etc/systemd/system/multi-user.target.wants/nrpe.service
lrwxrwxrwx 1 root root 36 Nov 21 07:31 /etc/systemd/system/multi-user.target.wants/nrpe.service -> /usr/lib/systemd/system/nrpe.service
[root@s930l3087 plugins]#
[root@s930l3087 plugins]# cat /usr/lib/systemd/system/nrpe.service
[Unit]
Description=Nagios Remote Program Executor
Documentation=http://www.nagios.org/documentation
Conflicts=nrpe.socket
Requires=network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=forking
User=nrpe
Group=nrpe
EnvironmentFile=/etc/sysconfig/nrpe
ExecStart=/usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d $NRPE_SSL_OPT
[root@s930l3087 plugins]#

Re: Install NRPE 3.2.1 on CentOS 7 server

Posted: Mon Nov 27, 2017 11:32 am
by lmiltchev
It seems like that the problem is caused by the $NRPE_SSL_OPT variable. Also, I see some "non-default" paths... Is this the entire "nrpe.service" file?

You can try modifying the nrpe.service file as the example below to see if this is going to resolve the issue. Make a backup of the original "nrpe.service" file first!

Code: Select all

# cat /usr/lib/systemd/system/nrpe.service
[Unit]
Description=Nagios Remote Plugin Executor
Documentation=http://www.nagios.org/documentation
After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target
[email protected] plymouth-quit.service xdm.service
Conflicts=nrpe.socket

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
Restart=on-abort
PIDFile=/usr/local/nagios/var/nrpe.pid
RuntimeDirectory=nrpe
RuntimeDirectoryMode=0755
ExecStart=/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f
ExecReload=/bin/kill -HUP $MAINPID
ExecStopPost=/bin/rm -f /usr/local/nagios/var/nrpe.pid
TimeoutStopSec=60
User=nagios
Group=nagios
PrivateTmp=true
OOMScoreAdjust=-500
Note: In the nrpe.cfg, I also have:

Code: Select all

pid_file=/usr/local/nagios/var/nrpe.pid

Code: Select all

# systemctl status nrpe.service
● nrpe.service - Nagios Remote Plugin Executor
   Loaded: loaded (/usr/lib/systemd/system/nrpe.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2017-11-27 10:29:43 CST; 7s ago
     Docs: http://www.nagios.org/documentation
  Process: 54176 ExecStopPost=/bin/rm -f /usr/local/nagios/var/nrpe.pid (code=exited, status=0/SUCCESS)
 Main PID: 54180 (nrpe)
   CGroup: /system.slice/nrpe.service
           └─54180 /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -f
Hope this helps.

Re: Install NRPE 3.2.1 on CentOS 7 server

Posted: Mon Dec 04, 2017 6:40 am
by bsivavani
I tried using the suggested code, but receiving below error while checking the status

[root@s93tl3101 system]# systemctl status nrpe
● nrpe.service - Nagios Remote Plugin Executor
Loaded: loaded (/usr/lib/systemd/system/nrpe.service; enabled; vendor preset: disabled)
Active: inactive (dead) since Mon 2017-12-04 12:39:42 CET; 1s ago
Docs: http://www.nagios.org/documentation
Process: 19248 ExecStart=/usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -d (code=exited, status=0/SUCCESS)
Main PID: 19248 (code=exited, status=0/SUCCESS)

Dec 04 12:39:42 s93tl3101 systemd[1]: Started Nagios Remote Plugin Executor.
Dec 04 12:39:42 s93tl3101 systemd[1]: Starting Nagios Remote Plugin Executor...
Dec 04 12:39:42 s93tl3101 nrpe[19249]: Starting up daemon
Dec 04 12:39:42 s93tl3101 nrpe[19249]: Cannot write to pidfile '/etc/nagios/nrpe.pid' - check your privileges.
[root@s93tl3101 system]#

Re: Install NRPE 3.2.1 on CentOS 7 server

Posted: Mon Dec 04, 2017 7:42 am
by bsivavani
Non default paths are because of we installed NRPE using rpm's.