HTTP service gets CRITICAL, bad configuration?

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.
reynierpm
Posts: 20
Joined: Mon Aug 31, 2015 9:55 pm

Re: HTTP service gets CRITICAL, bad configuration?

Post 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
        }
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: HTTP service gets CRITICAL, bad configuration?

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
reynierpm
Posts: 20
Joined: Mon Aug 31, 2015 9:55 pm

Re: HTTP service gets CRITICAL, bad configuration?

Post 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
reynierpm
Posts: 20
Joined: Mon Aug 31, 2015 9:55 pm

Re: HTTP service gets CRITICAL, bad configuration?

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: HTTP service gets CRITICAL, bad configuration?

Post 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 :)
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked