Page 1 of 1
Instalation error: httpd: apr_sockaddr_info_get() failed
Posted: Sat Nov 22, 2014 3:42 pm
by J0aquin
Hello,
I am trying to install Nagios Core 4.0.8 on CentOS 6.6 (64 bits). I have tried it on both full verision of the CentOS and the minimal version too. I am following the instructions on:
http://library.nagios.com/library/produ ... rom-source
and in both cases I got the same error. When I reach the instrution:
For RHEL/CentOS users:
/etc/init.d/httpd start
I get the error:
Code: Select all
Starting httpd: httpd: apr_sockaddr_info_get() failed for COMPUTERNAME
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
The httpd is running but it can not be seen from a web browser outside the server.
I have seen something similar for NagiosXI in other forums but not in this one with a solution specific for this conbination.
Could you help me please?
Re: Instalation error: httpd: apr_sockaddr_info_get() failed
Posted: Sat Nov 22, 2014 5:01 pm
by rhassing
I think it might be an firewall problem.
Please check if http is allowed in your iptable config.
This should give a list of iptables items, and also:
Code: Select all
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
If this line is not in there you could add it by typing setup (should work in CentOS).
Or you could edit the file "/etc/sysconfig/iptables" and copy a line (probably ssh/port 22 is in there) and replace the 22 with 80 for http.
Restart the iptables service after you changed it "/etc/init.d/iptables restart"
Re: Instalation error: httpd: apr_sockaddr_info_get() failed
Posted: Sun Nov 23, 2014 6:24 am
by J0aquin
Thank you. Effectively that line is not in iptables. I execute:
Code: Select all
iptables -A INPUT -p TCP --dport 80 -j ACCEPT
and when I execute
the following line is in there:
Code: Select all
ACCEPT tcp -- anywhere anywhere tcp dpt:http
I restart the httpd:
but it gives me the same message:
Code: Select all
Starting httpd: httpd: apr_sockaddr_info_get() failed for COMPUTERNAME
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
And the web server can not be accessed from a web browser in another computer.
Furthermore, if I restart the nagios server that I am configuring the httpd is running but if I excute
again, the addition made before is not there and the list of rules is the same as the beginig.
Please, any idea on what could be happening?
Re: Instalation error: httpd: apr_sockaddr_info_get() failed
Posted: Sun Nov 23, 2014 6:38 am
by rhassing
The error you get from the httpd is not really important. It's just a message your hostname could not be resolved.
For the iptables problem you should either use the "setup" command, or you should adjust the file "/etc/sysconfig/iptables" or use "iptables-save" after you added the line like described.
Re: Instalation error: httpd: apr_sockaddr_info_get() failed
Posted: Sun Nov 23, 2014 7:07 am
by rhassing
I can reproduce the problem on a virtual machine:
Code: Select all
[root@rhel6 ]# /etc/init.d/httpd restart
Stopping httpd: [FAILED]
Starting httpd: httpd: apr_sockaddr_info_get() failed for [b]rhel6[/b]
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
[root@rhel6 ]#
add the computername (in my case
rhel6) to the line with 127.0.0.1 in the
/etc/hosts file
Code: Select all
[root@rhel6 ]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 rhel6
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@rhel6 ]#
Change "
/etc/httpd/conf/httpd.conf" and adjust the line which starts with "ServerName". uncomment it and change it to your hostname.
I have changed it to:
The hostname should be in the "
/etc/hosts" file as well.
Code: Select all
[root@rhel6 ]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@rhel6 ]#
My iptables looks like this:
Code: Select all
[root@rhel6 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@rhel6 ~]#
I changed the file
"/etc/sysconfig/iptables":
Before:
Code: Select all
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
After:
Code: Select all
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
Re: Instalation error: httpd: apr_sockaddr_info_get() failed
Posted: Sun Nov 23, 2014 1:08 pm
by J0aquin
Thank you. I added the line:
Code: Select all
-A INPUT -p tcp -M state –state NEW -m tcp –dport 80 -j ACCEPT
to the /etc/sysconfig/iptables file and could get to the nagios page OK from another computer.
I also introduced the serverName in the conifg files indicated:
Code: Select all
/etc/hosts
/etc/httpd/conf/httpd.conf
and you con run
without any error message.
These two problems are solved. Now when I enter the Nagios Core web page, at the home page I see:
"Unable to get process status"
I have gone through the whole process of installing the Nagios Core again just in case the problems where related but it is still the same. I do not think the problem in this thread and this other problem are related so I will open a different thread.
thank you
Re: Instalation error: httpd: apr_sockaddr_info_get() failed
Posted: Mon Nov 24, 2014 10:20 am
by tmcdonald
Sounds good. I will close this one up and we'll see you in the other thread.