Page 1 of 5

Install nrpe on Ubuntu

Posted: Fri Aug 26, 2016 6:17 am
by Naveed
Hello,

I want to monitor my ubuntu servers with nagios xi.

I have successfully installed nrpe on ubuntu which is listening on port 5666 with localhost by following below How to
http://tecadmin.net/install-nrpe-on-ubuntu/#

I have added nagios IP address in /etc/nagios/nrpe.cfg and restart the service...
Firewall service is also disabled.

But I am unable to ping it from nagios and as I test it from nagios server by following command...
its just timeout after 10 seconds...


Nagios XI

/usr/local/nagios/libexec/check_nrpe -H client ip -p 5666

check nrpe service check timeout out after 10 seconds

Kindly assist..
Thank you!

Re: Install nrpe on Ubuntu

Posted: Fri Aug 26, 2016 10:33 am
by mcapra
That website appears to be offline, so pointing out potentially wrong steps is going to be difficult.

Are you able to run through our official documentation and describe problematic steps?
https://assets.nagios.com/downloads/nag ... _Agent.pdf

Re: Install nrpe on Ubuntu

Posted: Fri Aug 26, 2016 10:36 am
by bwallace
Socket timeout errors can be caused by the remote system not responding to the check. Either the command is formatted incorrectly, the server is not responding, or the target ip is wrong. It can also be caused by firewall issues, or route issues. It is a catchall error for when the checked system does not respond.

Checking nagios.log and running the most basic form of the check from the cli can shed some light on the problems. Port mapping the checked port from the nagios server can help as well. Otherwise you will need to check the remote system's associated logs for the checked service for any clues.

1) From Nagios's perspective, is port 5666 open? Run the following commands from the CLI on the nagios server and show us the output:

nmap <client ip> -p 5666


2) /usr/local/nagios/libexec/check_nrpe -H <client ip> (run this one few times then immediately run the cmd below)

tail -50 /var/log/messages

Re: Install nrpe on Ubuntu

Posted: Mon Aug 29, 2016 9:08 am
by Naveed
[root@AXmonitor libexec]# nmap 13.88.19.123 -p 5666

Starting Nmap 6.47 ( http://nmap.org ) at 2016-08-29 06:58 PDT
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 3.15 seconds

I have reinstalled the nrpe agent by following nagios xi documentation

[root@AXmonitor libexec]# nmap 13.88.19.123 -p 5666

Starting Nmap 6.47 ( http://nmap.org ) at 2016-08-29 06:58 PDT
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 3.15 seconds


root@HADB02:/usr/lib/nagios/plugins# ./check_nrpe -H 13.88.19.123
CHECK_NRPE: Error - Could not complete SSL handshake.
root@HADB02:/usr/lib/nagios/plugins# ./check_nrpe -H 127.0.0.1
CHECK_NRPE: Socket timeout after 10 seconds.

Kindly see the guide further.

Thank you!

Re: Install nrpe on Ubuntu

Posted: Mon Aug 29, 2016 9:56 am
by bwallace
That's nmap's way of saying the results are inconclusive. Nmap scans in stages and it uses ping for stage 1. Some FW / hosts don't respond to ping, hence the message "Host seems down. If it is really up, but blocking our ping probes, try -Pn"

Try using -Pn as it suggests, this will cause nmap to not use ping and we should get more accurate results.

From your Nagios XI server execute this command and provide the output (Where xxx is the IP address of the remote server):

Code: Select all

nmap -Pn -p T:5666 xxx

Re: Install nrpe on Ubuntu

Posted: Mon Aug 29, 2016 10:12 am
by Naveed
Thank you!

[root@AXmonitor vmn]# nmap -Pn -p T:5666 1.2.3.4

Starting Nmap 6.47 ( http://nmap.org ) at 2016-08-29 08:09 PDT
Nmap scan report for 1.2.3.4
Host is up (0.060s latency).
PORT STATE SERVICE
5666/tcp open nrpe

Nmap done: 1 IP address (1 host up) scanned in 0.21 seconds


Moreover I am testing it from client side as well.

On client side

root@HADB02:/usr/lib/nagios/plugins# ./check_nrpe -H 1.2.3.4
CHECK_NRPE: Error - Could not complete SSL handshake.
root@HADB02:/usr/lib/nagios/plugins# ./check_nrpe -H 127.0.0.1
CHECK_NRPE: Socket timeout after 10 seconds.

Kindly guide this about it as well.

Thank you!

Re: Install nrpe on Ubuntu

Posted: Mon Aug 29, 2016 10:27 am
by bwallace
Allright, now we know the target machine is indeed reachable from the Nagios box - thanks.

Since you're getting ""Could not complete SSL handshake" when run on the client, I'm betting that NRPE was not compiled with ssl enabled. Please run the following command from the Nagios server. If it works, then NRPE on the client was compiled without ssl support (the -n switch disables the use of SSL).
/usr/local/nagios/libexec/check_nrpe -H <remote host ip> -n

Also, if the problem persists, refer to section III of this doc and let us know what additional steps you took.
https://assets.nagios.com/downloads/nag ... utions.pdf

Re: Install nrpe on Ubuntu

Posted: Mon Aug 29, 2016 12:20 pm
by Naveed
Now I can ping my host and server together after allowing from azure end points configurations and inbound/outbound rules.


command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10
command[check_cpu]=/usr/lib/nagios/plugins/check_cpu -c 05 -w 10
command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/lib/nagios/plugins/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z
command[check_procs]=/usr/lib/nagios/plugins/check_procs -w 400 -c 500
command[check_ssh]=/usr/lib/nagios/plugins/check_ssh -H 127.0.0.1 -p22
command[check_swap]=/usr/lib/nagios/plugins/check_swap -w 30 -c 20
command[check_memory]=/usr/lib/nagios/plugins/check_memory -f -w 8 -c 5
command[check_disk]=/usr/lib/nagios/plugins/check_disk -w 08% -c 05% -p /
command[check_ntp]=/usr/lib/nagios/plugins/check_ntp -H 127.0.0.1 -w 10 -c 20
command[check_uptime]=/usr/lib/nagios/plugins/check_uptime
command[check_tcp22]=/usr/lib/nagios/plugins/check_tcp -H 127.0.0.1 -p 22 -w 30 -c 20
command[check_tcp5666]=/usr/lib/nagios/plugins/check_tcp -H 127.0.0.1 -p 5666 -w 30 -c 20
command[check_open_files]=/usr/lib/nagios/plugins/check_open_files -c 30 -w 50



my /etc/nagios/nrpe.cfg file

Please recommend what log messages we need to see for alerts.

I have already checked,
/var/log/syslog
/var/log/auth.log

Re: Install nrpe on Ubuntu

Posted: Mon Aug 29, 2016 2:25 pm
by lmiltchev
You should be able to find some clues in the "/var/log/syslog".

Can you run the following commands and show the output?

on the client:

Code: Select all

/usr/lib/nagios/plugins/check_users -w 5 -c 10
/usr/lib/nagios/plugins/check_cpu -c 05 -w 10
/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
on the Nagios XI server:

Code: Select all

nmap <client ip> -p 5666
/usr/local/nagios/libexec/check_nrpe -H <client ip>
/usr/local/nagios/libexec/check_nrpe -H <client ip> -n
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_users
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_cpu
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_load

Re: Install nrpe on Ubuntu

Posted: Mon Aug 29, 2016 2:57 pm
by Naveed
root@HAWEB02:/home/GIRU# /usr/lib/nagios/plugins/check_users -w 5 -c 10
USERS OK - 1 users currently logged in |users=1;5;10;0

root@HAWEB02:/home/GIRU# /usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
OK - load average: 0.00, 0.06, 0.11|load1=0.000;15.000;30.000;0; load5=0.060;10.000;25.000;0; load15=0.110;5.000;20.000;0;


[root@AXmonitor vmn]# nmap 1.2.3.4 -p 5666

Starting Nmap 6.47 ( http://nmap.org ) at 2016-08-29 12:53 PDT
Nmap scan report for 1.2.3.4
Host is up (0.060s latency).
PORT STATE SERVICE
5666/tcp open nrpe

Nmap done: 1 IP address (1 host up) scanned in 0.25 seconds
[root@AXmonitor vmn]#
[root@AXmonitor vmn]#
[root@AXmonitor vmn]# /usr/local/nagios/libexec/check_nrpe -H 1.2.3.4
NRPE v2.15
[root@AXmonitor vmn]# /usr/local/nagios/libexec/check_nrpe -H 1.2.3.4 -n
CHECK_NRPE: Error receiving data from daemon.
[root@AXmonitor vmn]# /usr/local/nagios/libexec/check_nrpe -H 1.2.3.4 -c check_users
NRPE: Unable to read output
[root@AXmonitor vmn]# /usr/local/nagios/libexec/check_nrpe -H 1.2.3.4 -c check_load
NRPE: Unable to read output