Page 2 of 3

Re: HTTP service gets CRITICAL, bad configuration?

Posted: Wed Sep 02, 2015 10:22 am
by reynierpm
jdalrymple wrote:Can you try to create an empty file /var/www/html/index.html and see if that resolves your problem?

**Edit**

To expand on what I asked, by default you will get 403 forbidden when running check_http against localhost in a CentOS box because directory listing is forbidden and you have no index file. If you create the file it will change the behavior of the system. It's a common occurrence that a base install of Nagios on base CentOS will have the problem you described if there is no index file in /var/www/html.
Yes, apparently that fix the issue:

Code: Select all

# /usr/local/nagios/libexec/check_http -H localhost
HTTP OK: HTTP/1.1 200 OK - 265 bytes in 0.001 second response time |time=0.001032s;;;0.000000 size=265B;;;0
Although I am still seeing CRITICAL on the service checking at Nagios Web interface:

Re: HTTP service gets CRITICAL, bad configuration?

Posted: Wed Sep 02, 2015 10:26 am
by jdalrymple
Did you per-chance change your commands.cfg or your service in order to resolve the issue using other methods, and perhaps something needs to be changed back?

Re: HTTP service gets CRITICAL, bad configuration?

Posted: Wed Sep 02, 2015 10:39 am
by reynierpm
No, I didn't I just changed the contacts.cfg in order to receive notifications email nothing else. Also I have restarted the Nagios service

Re: HTTP service gets CRITICAL, bad configuration?

Posted: Wed Sep 02, 2015 10:44 am
by jdalrymple
Something weird for sure.

Please send a tail of your /var/log/httpd/access_log and also /var/log/httpd/error_log.

Re: HTTP service gets CRITICAL, bad configuration?

Posted: Wed Sep 02, 2015 12:01 pm
by reynierpm
jdalrymple wrote:Something weird for sure.

Please send a tail of your /var/log/httpd/access_log and also /var/log/httpd/error_log.

Code: Select all

# tail /etc/httpd/logs/access_log
190.200.135.249 - nagiosadmin [02/Sep/2015:12:58:17 -0400] "GET /nagios/stylesheets/common.css?4.1.1 HTTP/1.1" 304 - "http://xxx.xxx.xxx.xxx/nagios/side.php" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
190.200.135.249 - nagiosadmin [02/Sep/2015:12:58:17 -0400] "GET /nagios/images/sblogo.png HTTP/1.1" 304 - "http://xxx.xxx.xxx.xxx/nagios/side.php" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
190.200.135.249 - nagiosadmin [02/Sep/2015:12:58:17 -0400] "GET /nagios/js/jquery-1.7.1.min.js HTTP/1.1" 304 - "http://xxx.xxx.xxx.xxx/nagios/main.php" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
190.200.135.249 - nagiosadmin [02/Sep/2015:12:58:17 -0400] "GET /nagios/images/sflogo.png HTTP/1.1" 304 - "http://xxx.xxx.xxx.xxx/nagios/main.php" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
190.200.135.249 - nagiosadmin [02/Sep/2015:12:58:17 -0400] "GET /nagios/images/logofullsize.png HTTP/1.1" 304 - "http://xxx.xxx.xxx.xxx/nagios/main.php" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
190.200.135.249 - nagiosadmin [02/Sep/2015:12:58:17 -0400] "GET /nagios/images/weblogo1.png HTTP/1.1" 304 - "http://xxx.xxx.xxx.xxx/nagios/main.php" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
190.200.135.249 - nagiosadmin [02/Sep/2015:12:58:17 -0400] "GET /nagios/images/passiveonly.gif HTTP/1.1" 304 - "http://xxx.xxx.xxx.xxx/nagios/main.php" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
190.200.135.249 - nagiosadmin [02/Sep/2015:12:58:17 -0400] "GET /nagios/cgi-bin/statusjson.cgi?query=programstatus HTTP/1.1" 200 988 "http://xxx.xxx.xxx.xxx/nagios/main.php" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
190.200.135.249 - nagiosadmin [02/Sep/2015:12:58:18 -0400] "GET /nagios/images/favicon.ico HTTP/1.1" 200 822 "http://xxx.xxx.xxx.xxx/nagios/" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"
190.200.135.249 - nagiosadmin [02/Sep/2015:12:58:19 -0400] "GET /nagios/cgi-bin/status.cgi?host=all HTTP/1.1" 200 14396 "http://xxx.xxx.xxx.xxx/nagios/side.php" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36"

# tail /etc/httpd/logs/error_log
[Wed Sep 02 10:12:38 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Sep 02 10:12:38 2015] [notice] Digest: generating secret for digest authentication ...
[Wed Sep 02 10:12:38 2015] [notice] Digest: done
[Wed Sep 02 10:12:38 2015] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.5.28 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips mod_wsgi/3.2 Python/2.6.6 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Wed Sep 02 11:06:26 2015] [notice] caught SIGTERM, shutting down
[Wed Sep 02 11:06:26 2015] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Wed Sep 02 11:06:26 2015] [notice] Digest: generating secret for digest authentication ...
[Wed Sep 02 11:06:26 2015] [notice] Digest: done
[Wed Sep 02 11:06:26 2015] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.5.28 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips mod_wsgi/3.2 Python/2.6.6 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Wed Sep 02 11:06:47 2015] [error] [client ::1] Directory index forbidden by Options directive: /var/www/html/
PS: xxx.xxx.xxx.xxx means my public address IP for security I won't be leave this public (if you need it PM and I can tell you)

Re: HTTP service gets CRITICAL, bad configuration?

Posted: Wed Sep 02, 2015 4:54 pm
by tmcdonald
Let's run this as the nagios user, and with some extras thrown in:

Code: Select all

su nagios
/usr/local/nagios/libexec/check_http -H localhost -vvv > /tmp/check_http.txt
echo $?
Then send us /tmp/check_http.txt and show us the output of the command.

Re: HTTP service gets CRITICAL, bad configuration?

Posted: Wed Sep 02, 2015 4:58 pm
by reynierpm
tmcdonald wrote:Let's run this as the nagios user, and with some extras thrown in:

Code: Select all

su nagios
/usr/local/nagios/libexec/check_http -H localhost -vvv > /tmp/check_http.txt
echo $?
Then send us /tmp/check_http.txt and show us the output of the command.
This is the content of check_http.txt file after run the command above as nagios user:

Code: Select all

GET / HTTP/1.1
User-Agent: check_http/v2.1.1 (nagios-plugins 2.1.1)
Connection: close
Host: localhost
Accept: */*


http://localhost:80/ is 265 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Date: Wed, 02 Sep 2015 21:56:57 GMT
Server: Apache/2.2.15 (CentOS)
Last-Modified: Wed, 02 Sep 2015 15:19:58 GMT
ETag: "80619-0-51ec5331746ab"
Accept-Ranges: bytes
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8

**** CONTENT ****

HTTP OK: HTTP/1.1 200 OK - 265 bytes in 0.001 second response time |time=0.000882s;;;0.000000 size=265B;;;0

Re: HTTP service gets CRITICAL, bad configuration?

Posted: Wed Sep 02, 2015 7:21 pm
by Box293
Can you please post the nagios definitions for:
The host object localhost
The service HTTP
The command that the HTTP service uses

Re: HTTP service gets CRITICAL, bad configuration?

Posted: Wed Sep 02, 2015 7:29 pm
by reynierpm
Box293 wrote:Can you please post the nagios definitions for:
The host object localhost
The service HTTP
The command that the HTTP service uses
The host object:

Code: Select all

# Define a host for the local machine

define host{
        use                     linux-server            ; Name of host template to use
                                                        ; This host definition will inherit all variables that are defined
                                                        ; in (or inherited by) the linux-server host template definition.
        host_name               localhost
        alias                   localhost
        address                 127.0.0.1
        }
The service HTTP:

Code: Select all

# 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
        }
And this one The service HTTP I don't know what you mean or need

Re: HTTP service gets CRITICAL, bad configuration?

Posted: Wed Sep 02, 2015 7:31 pm
by Box293
In your file localhost.cfg there will be a define service { for HTTP, please post that.