Page 3 of 3
Re: HTTP service gets CRITICAL, bad configuration?
Posted: Wed Sep 02, 2015 7:36 pm
by reynierpm
Box293 wrote:In your file localhost.cfg there will be a define service { for HTTP, please post that.
There you go:
Code: Select all
# Define a service to check HTTP on the local machine.
# Disable notifications for this service by default, as not all users may have HTTP enabled.
define service{
use local-service ; Name of service template to use
host_name localhost
service_description HTTP
check_command check_http
notifications_enabled 0
}
Re: HTTP service gets CRITICAL, bad configuration?
Posted: Wed Sep 02, 2015 7:43 pm
by Box293
So looking at your configs, Nagios is using the following command:
Code: Select all
/usr/local/nagios/libexec/check_http -I 127.0.0.1
Can you run this again as it's using the
-I (capital i) argument whereas
@tmcdonald's command used the
-H argument AND a dns name instead of an IP Address.
Code: Select all
su nagios
/usr/local/nagios/libexec/check_http -I 127.0.0.1 -vvv > /tmp/check_http.txt
echo $?
Post the results.
Re: HTTP service gets CRITICAL, bad configuration?
Posted: Wed Sep 02, 2015 7:46 pm
by reynierpm
Box293 wrote:So looking at your configs, Nagios is using the following command:
Code: Select all
/usr/local/nagios/libexec/check_http -I 127.0.0.1
Can you run this again as it's using the
-I (capital i) argument whereas
@tmcdonald's command used the
-H argument AND a dns name instead of an IP Address.
Code: Select all
su nagios
/usr/local/nagios/libexec/check_http -I 127.0.0.1 -vvv > /tmp/check_http.txt
echo $?
Post the results.
Results as requested:
Code: Select all
GET / HTTP/1.0
User-Agent: check_http/v2.1.1 (nagios-plugins 2.1.1)
Connection: close
Accept: */*
http://127.0.0.1:80/ is 810 characters
STATUS: HTTP/1.1 500 Internal Server Error
**** HEADER ****
Date: Thu, 03 Sep 2015 00:45:50 GMT
Server: Apache/2.2.15 (CentOS)
Content-Length: 618
Connection: close
Content-Type: text/html; charset=iso-8859-1
**** CONTENT ****
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
root@localhost and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.2.15 (CentOS) Server at admin.qa.pdone.com Port 80</address>
</body></html>
HTTP CRITICAL: HTTP/1.1 500 Internal Server Error - 810 bytes in 0.001 second response time |time=0.001303s;;;0.000000 size=810B;;;0
Re: HTTP service gets CRITICAL, bad configuration?
Posted: Wed Sep 02, 2015 7:55 pm
by reynierpm
Thanks to @Box293 who point me on the right direction, after ran the latest command I can see where the issue was: bad configuration at VirtualHost definition in Apache side. Moving the
localhost definition to the top make all services works good and Nagios stop showing me the CRITICAL flag. Also I did add a new ServerAlias 127.0.0.1. The VH definition looks like:
Code: Select all
<VirtualHost *:80>
ServerName localhost
ServerAlias xxx.xxx.xxx.xxx (public IP address)
ServerAlias 127.0.0.1
DocumentRoot /var/www/html
<Directory /var/www/html>
# enable the .htaccess rewrites
AllowOverride All
Order allow,deny
Allow from All
</Directory>
</VirtualHost>
Thanks to everyone
Re: HTTP service gets CRITICAL, bad configuration?
Posted: Wed Sep 02, 2015 8:02 pm
by Box293
Strange it works for -H 127.0.0.1 and not -I 127.0.0.1
Can you try deleting the file and creating again:
Code: Select all
rm -f /var/www/html/index.html
echo '' > /var/www/html/index.html
If that does not fix the problem, can you please post the results of these commands:
Code: Select all
ls -al /var/www/html/index.html
grep apache /etc/passwd
grep apache /etc/group
[/s]
I'm glad you fixed your issue
