Install NRPE 3.2.1 on CentOS 7 server

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
bsivavani
Posts: 339
Joined: Tue Oct 06, 2015 9:17 am

Install NRPE 3.2.1 on CentOS 7 server

Post 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 ?
dwasswa

Re: Install NRPE 3.2.1 on CentOS 7 server

Post 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.
bsivavani
Posts: 339
Joined: Tue Oct 06, 2015 9:17 am

Re: Install NRPE 3.2.1 on CentOS 7 server

Post 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 ?
You do not have the required permissions to view the files attached to this post.
kyang

Re: Install NRPE 3.2.1 on CentOS 7 server

Post 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 
bsivavani
Posts: 339
Joined: Tue Oct 06, 2015 9:17 am

Re: Install NRPE 3.2.1 on CentOS 7 server

Post 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 ?
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Install NRPE 3.2.1 on CentOS 7 server

Post 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).
Be sure to check out our Knowledgebase for helpful articles and solutions!
bsivavani
Posts: 339
Joined: Tue Oct 06, 2015 9:17 am

Re: Install NRPE 3.2.1 on CentOS 7 server

Post 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]#
You do not have the required permissions to view the files attached to this post.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Install NRPE 3.2.1 on CentOS 7 server

Post 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
Before=getty@tty1.service 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
bsivavani
Posts: 339
Joined: Tue Oct 06, 2015 9:17 am

Re: Install NRPE 3.2.1 on CentOS 7 server

Post 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]#
bsivavani
Posts: 339
Joined: Tue Oct 06, 2015 9:17 am

Re: Install NRPE 3.2.1 on CentOS 7 server

Post by bsivavani »

Non default paths are because of we installed NRPE using rpm's.
Locked