port 5666: Connection refused SAVE ME , I tried everything

Discuss new project and feature ideas here.
See labs.nagios.com for new projects under development.

port 5666: Connection refused SAVE ME , I tried everything

Postby pohlin » Tue Feb 06, 2018 11:08 pm

First, I download nrpe from source, upon configuring, i reached this step:
sed -i '/^allowed_hosts=/s/$/,10.25.5.2/' /usr/local/nagios/etc/nrpe.cfg
which i need to put my nagios server ip there, but it shows something sed: unknown option 's'

So i tried download nrpe script which it could configure automatically and i just have to type nagios server ip to allowed to connect to nrpe.
I even tiredvi /etc/xinetd.d/nrpe , the nagios server ip is written allowed.

but when i test /usr/local/nagios/libexec/check_nrpe -H <my nagios server ip>
it says could not connect, connection reset by peer
and on the web interface it shows (No output on stdout) stderr: connect to address 192.168.0.137 port 5666: Connection refused

so i googled alot, some say i should install telnet, but it shows pycurl error 22, 401 autherization required
some say it may be behind a proxy, but when i try curl -vv http://mirror.centos.org/centos/6/cr/x8 ... repomd.xml
it says HTTP/1.1 401 Authentication Required, Connection: keep alive
so im not sure if im behind a proxy or not but i tried https://support.nagios.com/kb/article.php?id=147 to solve it

it says i need to access SSH, then triedhttps://assets.nagios.com/download ... 1517278131
when i reach the stepssh-copy-id -i ~/.ssh/id_rsa.pub nagios@remoteip
it says could not resolve hostname remote ip, name or service not known

i also tried /etc/yum.conf
and it says permission denied

i tried everything and everything seems to have a problem with 401 authorization required or permission denied
I really dont know what to do anymore
Last edited by dwhitfield on Wed Feb 07, 2018 11:07 am, edited 1 time in total.
Reason: code blocks FTW
pohlin
 
Posts: 10
Joined: Wed Jan 31, 2018 10:08 pm

Re: port 5666: Connection refused SAVE ME , I tried everythi

Postby npolovenko » Wed Feb 07, 2018 12:21 pm

Hello, @pohlin. I like the title of your thread :D Are you using XI or Core? What tutorial did you use to install nrpe? Please upload the nrpe.cfg from the remote server:
Code: Select all
/usr/local/nagios/etc/nrpe.cfg

And, from the nagios server please run:
Code: Select all
nmap remote_nrpe_server_ip_address

And show us the output. If nmap is not isnatalled you can install it with:
Code: Select all
yum install nmap

or
Code: Select all
apt-get install nmap
User avatar
npolovenko
Support Tech
 
Posts: 1315
Joined: Mon May 15, 2017 5:00 pm

Re: port 5666: Connection refused SAVE ME , I tried everythi

Postby pohlin » Wed Feb 07, 2018 8:42 pm

im using nagiosxi.

/usr/local/nagios/etc/nrpe.cfg
Permission denied

nmap remote_nrpe_server_ip_address
Starting Nmap 6.47 (http://namp.org) at 2018-02-08 9:37 +08
Failed to resolver "Remote_nrpe_server_ip_address".
WARNING : No targets were specified, so 0hosts scanned.
Nmap done: 0 IP addresses (0 hosts up) scaneed in 0.03 seconds

it says PYCURL ERROR 22, the requested url returned erro 401 authorization required
when i try yum install nmap
pohlin
 
Posts: 10
Joined: Wed Jan 31, 2018 10:08 pm

Re: port 5666: Connection refused SAVE ME , I tried everythi

Postby pohlin » Wed Feb 07, 2018 8:52 pm

at first i tried
https://support.nagios.com/kb/article.php?id=515
but faced an issue: sed:unknow option 's'
i saw online, changing the / to | will work, but i tried,still couldnt.

So then i tried an install script
https://support.nagios.com/kb/article.php?id=8
but i couldnt download it in my virtual machine, it says 401 authorization required, so I download it locally and then import it into the virtual machine using WinSCP
pohlin
 
Posts: 10
Joined: Wed Jan 31, 2018 10:08 pm

Re: port 5666: Connection refused SAVE ME , I tried everythi

Postby npolovenko » Thu Feb 08, 2018 11:39 am

@pohlin, If nmap gives you:
Code: Select all
Failed to resolver "Remote_nrpe_server_ip_address".

That means the remote nrpe server cannot communicate with the main Nagios server. You probably have some proxy issues. But both servers have to be on the same network and you should be able to nmap IP_address -p 5666.

PS: For monitoring hosts using ssh questions please open a new thread as this is not related to NRPE. That'll make our forum more organized for other users in future.
User avatar
npolovenko
Support Tech
 
Posts: 1315
Joined: Mon May 15, 2017 5:00 pm

Re: port 5666: Connection refused SAVE ME , I tried everythi

Postby pohlin » Mon Feb 12, 2018 9:23 pm

after i try nmap
it shows:

Stariting Nmap 6.47 (http://nmap.org) at 2018-02-13 10;02 +08
Nmap scan report for 192.168.0.137
Host is up (0.0026s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
22/tcp open ssh
8000/tcp open http-alt
MAC Address:78:A5:04:DD:C9:4A (Tesxas Instruments)

Nmap done: 1 Ip address (1 host up) scanned in 0.90 seconds
pohlin
 
Posts: 10
Joined: Wed Jan 31, 2018 10:08 pm

Re: port 5666: Connection refused SAVE ME , I tried everythi

Postby pohlin » Mon Feb 12, 2018 9:39 pm

i forgot to type -p 5666
it shows:
host is up
PORT STATE SERVICE
5666/tcp closed nrpe

itried
iptables -I INPUT -p tcp -s 192.168.0.137 --dport 5666 -j ACCEPT

but it still shows 5666/tcp closed nrpe
pohlin
 
Posts: 10
Joined: Wed Jan 31, 2018 10:08 pm

Re: port 5666: Connection refused SAVE ME , I tried everythi

Postby lmiltchev » Tue Feb 13, 2018 2:47 pm

Let's check a few things.

To see if nrpe is running, run the following commands on the remote box, and show the output:
Code: Select all
ps axuw | grep nrpe
netstat -at | grep nrpe


To see the firewall rules run:
Code: Select all
iptables -nL


You could temporarily stop the iptables for troubleshooting purposes, and run the check to see if it's going to work:
Code: Select all
/usr/local/nagios/libexec/check_nrpe -H 192.168.0.137


Upload the "/usr/local/nagios/etc/nrpe.cfg" and "/etc/xinetd.d/nrpe" (if it exists) file from the remote server to the forum. Rename files with *.txt extension if needed.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
lmiltchev
QA Manager
 
Posts: 9775
Joined: Mon May 23, 2011 12:15 pm

Re: port 5666: Connection refused SAVE ME , I tried everythi

Postby pohlin » Wed Feb 14, 2018 5:11 am

/usr/local/nagios/libexec/check_nrpe -H 192.168.0.137
output:
connect to address 192.168.0.137 port 5666: Connection refused
connect to host 192.168.0.137 port 5666: Connection refused

ps axuw | grep nrpe
output:
root 18058 0.0 0.0 103320 892 tty1 S+ 18"03 0:00 grep nrpe

netstat -at | grep nrpe
output:
tcp 0 0 *:nrpe *:* LISTEN

iptables -nL
output:
3.png
3.png (10.91 KiB) Viewed 562 times


"/usr/local/nagios/etc/nrpe.cfg"
output:
nrpe 1.png
nrpe 1.png (10.22 KiB) Viewed 562 times

nrpe.png
nrpe.png (9.16 KiB) Viewed 562 times
pohlin
 
Posts: 10
Joined: Wed Jan 31, 2018 10:08 pm

Re: port 5666: Connection refused SAVE ME , I tried everythi

Postby pohlin » Wed Feb 14, 2018 5:13 am

for "/etc/xinetd.d/nrpe"
output:
xinetd.d.png
xinetd.d.png (5.91 KiB) Viewed 562 times
pohlin
 
Posts: 10
Joined: Wed Jan 31, 2018 10:08 pm

Next

Return to Nagios Ideas

Who is online

Users browsing this forum: No registered users and 1 guest