Page 1 of 2
NRPE Test Error
Posted: Thu Oct 24, 2019 1:24 pm
by Eudes87
Hello friends, first forgive me for my weak english. Although I only installed the check_nrpe plug-in on the nagios core server successfully, by running a plug-in test run on the nagios server itself and writing to localhost or a machine that is already monitored by other plugins (check_ping, check_ssh, check_local_procs, check_tcp) and have agent NRPE (Centos) / NSclient (Windows), a message is occurring below:
Pointing to "localhost" itself:
Code: Select all
# /usr/local/nagios/libexec/check_nrpe -H localhost
connect to address 127.0.0.1 port 5666: Connection refused
Pointing to IP "Windows":
Code: Select all
# /usr/local/nagios/libexec/check_nrpe -H 10.xxx.40.xx
CHECK_NRPE: Error - Could not connect to 10.xxx.40.xx: Connection reset by peer
Code: Select all
# /usr/local/nagios/libexec/check_nrpe -H 10.xxx.40.xx -n
CHECK_NRPE: Receive header underflow - only -1 bytes received (4 expected).
Pointing to IP "CentOS":
Code: Select all
# /usr/local/nagios/libexec/check_nrpe -H 10.xxx.40.4x
CHECK_NRPE: Error - Could not connect to 10.xxx.40.4x. Check system logs on 10.227.40.46
Code: Select all
# /usr/local/nagios/libexec/check_nrpe -H 10.xxx.40.4x -n
CHECK_NRPE: Receive header underflow - only -1 bytes received (4 expected).
I am attaching some files that may be needed for your analysis.
nsclient.ini (Host Windows)
https://textuploader.com/1kxwp
nrpe.cfg (Host CentOS)
https://textuploader.com/1kxw7
Thanks.
Re: NRPE Test Error
Posted: Thu Oct 24, 2019 3:21 pm
by lmiltchev
Let's first try to make NRPE work "locally" (Pointing to "localhost" itself). Open the nrpe.cfg file, and change this:
Code: Select all
allowed_hosts=10.227.42.xxx 127.0.0.1
to this:
Code: Select all
allowed_hosts=10.227.42.xxx,127.0.0.1
Also, change this:
to this:
Save, exit, and restart NRPE daemon.
Run the following commands and show the output:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H localhost
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
/usr/local/nagios/bin/nrpe -V
ps -ef | grep -i nrpe | grep -v grep
Re: NRPE Test Error
Posted: Thu Oct 24, 2019 3:26 pm
by benjaminsmith
Hello
@Eudes87,
Let's start by getting it working with the CentOS server. Double check the nrpe.cfg that you have added the Nagios server IP address to the allowed_hosts field.
Code: Select all
allowed_hosts=127.0.0.1,<Nagios XI server ip>
Then verify that nrpe is running on the server and try once more.
Code: Select all
systemctl status xinetd
# OR... depending on how NRPE was installed
systemctl status nrpe
When you compiled NRPE on the CentOS server did you "--enable-command-args"" and follow our instructions?
https://support.nagios.com/kb/article.php?id=515#CentOS
Re: NRPE Test Error
Posted: Fri Oct 25, 2019 7:09 am
by Eudes87
benjaminsmith wrote:Hello
@Eudes87,
Let's start by getting it working with the CentOS server. Double check the nrpe.cfg that you have added the Nagios server IP address to the allowed_hosts field.
Code: Select all
allowed_hosts=127.0.0.1,<Nagios XI server ip>
Hello
@benjaminsmith,
The "allow" line had space because I saw this article.
https://support.nagios.com/kb/article/n ... e-615.html
I changed the nrpe.cfg file delimited by comma.
Then verify that nrpe is running on the server and try once more.
Code: Select all
systemctl status xinetd
# OR... depending on how NRPE was installed
systemctl status nrpe
It's all right about the service apparently.
Code: Select all
# systemctl status nrpe
● nrpe.service - Nagios Remote Program Executor
Loaded: loaded (/usr/lib/systemd/system/nrpe.service; enabled; vendor preset: disabled)
Active: active (running) since Sex 2019-10-25 08:38:14 -03; 3s ago
Docs: http://www.nagios.org/documentation
Process: 3216 ExecStopPost=/bin/rm -f /var/run/nrpe/nrpe.pid (code=exited, status=0/SUCCESS)
Main PID: 3217 (nrpe)
CGroup: /system.slice/nrpe.service
└─3217 /usr/sbin/nrpe -c /etc/nagios/nrpe.cfg -f
Out 25 08:38:14 fileserver.dexter.com.br systemd[1]: Stopped Nagios Remote Program Executor.
Out 25 08:38:14 fileserver.dexter.com.br systemd[1]: Started Nagios Remote Program Executor.
Out 25 08:38:14 fileserver.dexter.com.br nrpe[3217]: Starting up daemon
Out 25 08:38:14 fileserver.dexter.com.br nrpe[3217]: Server listening on 0.0.0.0 port 5666.
Out 25 08:38:14 fileserver.dexter.com.br nrpe[3217]: Server listening on :: port 5666.
Out 25 08:38:14 fileserver.dexter.com.br nrpe[3217]: Listening for connections on port 5666
Out 25 08:38:14 fileserver.dexter.com.br nrpe[3217]: Allowing connections from: 127.0.0.1,10.xxx.x0.xxx
As for the compilation, I don't know if you used "./configure --enable-command-args".
This machine was already being monitored and it wasn't me who installed the plugin on this machine.
I ran the command below on the nagios server for host centos and this time it worked.
Code: Select all
# /usr/local/nagios/libexec/check_nrpe -H 10.xxx.xx.xxx
NRPE v3.2.1
Funny that I did a comma delimiting test, changed the file, restarted the nrpe service and it didn't work.
Is it also necessary to restart the host?
Problem persists when running command (Nagios Server and Windows machine)
Re: NRPE Test Error
Posted: Fri Oct 25, 2019 8:36 am
by Eudes87
lmiltchev wrote:Let's first try to make NRPE work "locally" (Pointing to "localhost" itself). Open the nrpe.cfg file, and change this:
Code: Select all
allowed_hosts=10.227.42.xxx 127.0.0.1
to this:
Code: Select all
allowed_hosts=10.227.42.xxx,127.0.0.1
Also, change this:
to this:
Save, exit, and restart NRPE daemon.
Hello
@lmiltchev
On the server I only have the plugin "check_nrpe" in the / usr / local / nagios / libexec folder, there is no daemon service, I believe.
I ran a find and found the nrpe.cfg file in the /tmp/nrpe-3.2.1/sample-config/nrpe.cfg folder but I believe it is not even used, this is the directory where I downloaded the plugin.
Run the following commands and show the output:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H localhost
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
/usr/local/nagios/bin/nrpe -V
ps -ef | grep -i nrpe | grep -v grep
The test command returns the same error.
Nonexistent file or directory
Nothing is listed after the command.
Re: NRPE Test Error
Posted: Fri Oct 25, 2019 3:04 pm
by benjaminsmith
Hello,
From you Nagios server, run an nmap command on the remote host running CentOS. You should see port 5666 open. If not you may have a firewall/configuration issue or NRPE is not running.
PORT STATE SERVICE
22/tcp open ssh
5666/tcp open nrpe
This document is helpful for troubleshooting NRPE connection issues.
https://support.nagios.com/kb/article/n ... e-615.html
Re: NRPE Test Error
Posted: Mon Oct 28, 2019 6:24 am
by Eudes87
benjaminsmith wrote:Hello,
From you Nagios server, run an nmap command on the remote host running CentOS. You should see port 5666 open. If not you may have a firewall/configuration issue or NRPE is not running.
PORT STATE SERVICE
22/tcp open ssh
5666/tcp open nrpe
This document is helpful for troubleshooting NRPE connection issues.
https://support.nagios.com/kb/article/n ... e-615.html
Hello,
@benjaminsmith
It seems to be all right with the door.
~$ nmap 10.xxx.xxx.xxx
Starting Nmap 7.60 (
https://nmap.org ) at 2019-10-28 08:19 -03
Nmap scan report for 10.xxx.xxx.xxx
Host is up (0.0013s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
22/tcp open ssh
111/tcp open rpcbind
5666/tcp open nrpe
Nmap done: 1 IP address (1 host up) scanned in 0.67 seconds
As I commented before, the problem only persists on windows and nagios server
On host centOS I can already monitor the CPU through NRPE.
Re: NRPE Test Error
Posted: Tue Oct 29, 2019 2:25 pm
by benjaminsmith
Hello,
As I commented before, the problem only persists on windows and nagios server
On host centOS I can already monitor the CPU through NRPE.
Well, if you have the CentOS system working now, let's focus on the Windows device. The NSClient ini file can be a sensitive with the syntax. I've attached a starter configuration file you can try using on this system as it works on my test system. Be sure to backup your existing configuration and re-start the service after making any changes.
Also, when testing commands, please post the output errors to the thread. Thanks.
Re: NRPE Test Error
Posted: Wed Oct 30, 2019 12:30 pm
by Eudes87
benjaminsmith wrote:Hello,
As I commented before, the problem only persists on windows and nagios server
On host centOS I can already monitor the CPU through NRPE.
Well, if you have the CentOS system working now, let's focus on the Windows device. The NSClient ini file can be a sensitive with the syntax. I've attached a starter configuration file you can try using on this system as it works on my test system. Be sure to backup your existing configuration and re-start the service after making any changes.
Also, when testing commands, please post the output errors to the thread. Thanks.
Hello
@benjaminsmith,
After replacing my nsclient.ini file with your, monitoring it started working again.
Thank you so much for all your help in troubleshooting.
Regarding the Nagios server, I get a message:
Code: Select all
# / usr / local / nagios / libexec / check_nrpe -H localhost
connect to address 127.0.0.1 port 5666: Connection refused
nagios server has only the check_nrpe plug-in, no service. Is necessary install complete plugin?
Code: Select all
# nmap localhost
Starting Nmap 7.60 ( https://nmap.org ) at 2019-10-30 14:29 -03
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000013s latency).
rDNS record for 127.0.0.1: localhost.localdomain
Not shown: 994 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
80/tcp open http
443/tcp open https
3306/tcp open mysql
8080/tcp open http-proxy
Re: NRPE Test Error
Posted: Wed Oct 30, 2019 1:20 pm
by benjaminsmith
Hello,
After replacing my nsclient.ini file with your, monitoring it started working again.
Thank you so much for all your help in troubleshooting.
Glad that worked.
Regarding NRPE, it's not necessary to have the NRPE daemon running on the Nagios Server.
NRPE - Agent and Plugin Explained