Socket timeout / Connection Refused

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Socket timeout / Connection Refused

Post by abrist »

You can ignore the warnings. You will have to add your iptables rules to:

Code: Select all

/etc/init.d/iptables.rules
To get nagios to start on boot, you need to add it to the init system in the same way you added iptables (except for downloading the init script as it already exists in /etc/init.d):

Code: Select all

update-rc.d nagios defaults
And you may need to add httpd (apache2) as well:

Code: Select all

update-rc.d apache2 defaults
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: Socket timeout / Connection Refused

Post by DiegoAnjos »

abrist

I tried to add Nagios to startup but now I can not start apache2.
Nagios can be started/stopped but I am not able to access it on web.

[*]srvnagios:~# /etc/init.d/apache2 start
Starting web server: apache2(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
failed!

How can I revert this mess?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Socket timeout / Connection Refused

Post by abrist »

Looks like apache is already loading on boot? Remove the extra from the rc system:

Code: Select all

update-rc.d apache2 remove
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: Socket timeout / Connection Refused

Post by DiegoAnjos »

Did not work.

srvnagios:~# /etc/init.d/apache2 status
Apache2 is NOT running.

But I can not start it. Same error.
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: Socket timeout / Connection Refused

Post by DiegoAnjos »

I restarted the Debian machine and apache started as well. But if I stop it, I am not able to start it again.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Socket timeout / Connection Refused

Post by abrist »

Check to make sure you do not have more than 1 instance of apache running:

Code: Select all

ps -aef | grep apache
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: Socket timeout / Connection Refused

Post by DiegoAnjos »

srvnagios:~# ps -aef | grep apache
root 1117 1 0 18:19 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 1139 1117 0 18:20 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 1140 1117 0 18:20 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 1141 1117 0 18:20 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 1142 1117 0 18:20 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 1143 1117 0 18:20 ? 00:00:00 /usr/sbin/apache2 -k start
root 2088 2063 0 18:21 pts/0 00:00:00 grep apache
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Socket timeout / Connection Refused

Post by yancy »

Diego,
The issue is that NSClient (0.3.8) is not sending information to Nagios.
By default NSClient is an active check, which means Nagios (on your Debian machine) starts the connection and receives a reply. Since Nagios initiates the communication, this is probably not an issue with firewalls or listening ports.

can you give this a try.

Code: Select all

 /usr/local/nagios/libexec/check_nrpe -H xx.xx.xx.xx 
where xx.xx.xx.xx is the ip address of you nsclient machine.

also, the location of check_nrpe may be different if you compiled from source, but it should be in the same location as check_ping which you've been using.

Thanks,

-Yancy
DiegoAnjos
Posts: 49
Joined: Thu Feb 14, 2013 9:32 am

Re: Socket timeout / Connection Refused

Post by DiegoAnjos »

hum... thanks yancy for you help.

In fact I do not have check_nrpe on libexec folder:

Code: Select all

srvnagios:/usr/local/nagios/libexec# ./check_nrpe -H XX.XX.XX.XX
-bash: ./check_nrpe: No such file or directory
but I gave a try of check_ping and...

Code: Select all

srvnagios:/usr/local/nagios/libexec# ./check_ping -H XX.XX.X.X -w 3000.0,80% -c 5000.0,100% -p 5
PING OK - Packet loss = 0%, RTA = 0.47 ms|rta=0.471000ms;3000.000000;5000.000000;0.000000 pl=0%;80;100;0
I compiled Nagios from source, following the "Quickstart Guide" from Nagios website.

I have other plugins on libexec folder:
  • check_apt check_flexlm check_mailq check_ping check_udp
    check_breeze check_ftp check_mrtg check_pop check_ups
    check_by_ssh check_hpjd check_mrtgtraf check_procs check_users
    check_clamd check_http check_nagios check_real check_wave
    check_cluster check_icmp check_nntp check_rpc negate
    check_dhcp check_ide_smart check_nt check_sensors urlize
    check_dig check_ifoperstatus check_ntp check_smtp utils.pm
    check_disk check_ifstatus check_ntp_peer check_snmp utils.sh
    check_disk_smb check_imap check_ntp_time check_ssh
    check_dns check_ircd check_nwstat check_swap
    check_dummy check_load check_oracle check_tcp
    check_file_age check_log check_overcr check_time
How can I install "check_nrpe"?
yancy
Posts: 523
Joined: Thu Oct 06, 2011 10:12 am

Re: Socket timeout / Connection Refused

Post by yancy »

DiegoAnjos,

sounds like you need to also compile the plugins.

plugins can be found here:
http://www.nagios.org/download/plugins


-Yancy
Locked