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

HTTP service gets CRITICAL, bad configuration?

Post by reynierpm »

Hi there, I am compiled and installed Nagios and I didn't setup anything else. After start Nagios and goes to web interface I can see HTTP service is getting CRITICAL flag and service is up and running. I think I am missing something on the configuration but I don't know where to look - for the right documentation - or what to change in configuration files. At localhost.cfg I can see this service definition:

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
        }
Then at commands.cfg I have this:

Code: Select all

# 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
        }
What is missing here?
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: HTTP service gets CRITICAL, bad configuration?

Post by hsmith »

reynierpm wrote:Hi there, I am compiled and installed Nagios and I didn't setup anything else. After start Nagios and goes to web interface I can see HTTP service is getting CRITICAL flag and service is up and running. I think I am missing something on the configuration but I don't know where to look - for the right documentation - or what to change in configuration files. At localhost.cfg I can see this service definition:

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
        }
Then at commands.cfg I have this:

Code: Select all

# 'check_http' command definition
define command{
        command_name    check_http
        command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
        }
What is missing here?
What OS did you install Nagios on?
What version of Nagios did you install?
What does the return of a service httpd status look like?
Former Nagios Employee.
me.
reynierpm
Posts: 20
Joined: Mon Aug 31, 2015 9:55 pm

Re: HTTP service gets CRITICAL, bad configuration?

Post by reynierpm »

hsmith wrote: What OS did you install Nagios on?
What version of Nagios did you install?
What does the return of a service httpd status look like?
What OS did you install Nagios on? => CentOS 6.7
What version of Nagios did you install? => Nagios Core 4.1.1
What does the return of a service httpd status look like?[/quote] => httpd (pid 24075) is running...
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: HTTP service gets CRITICAL, bad configuration?

Post by hsmith »

reynierpm wrote:
hsmith wrote: What OS did you install Nagios on?
What version of Nagios did you install?
What does the return of a service httpd status look like?
What OS did you install Nagios on? => CentOS 6.7
What version of Nagios did you install? => Nagios Core 4.1.1
What does the return of a service httpd status look like? => httpd (pid 24075) is running...
What's SELinux up to?

Try issuing a getenforce.
Former Nagios Employee.
me.
reynierpm
Posts: 20
Joined: Mon Aug 31, 2015 9:55 pm

Re: HTTP service gets CRITICAL, bad configuration?

Post by reynierpm »

Code: Select all

# getenforce
Disabled
SELINUX is disabled
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: HTTP service gets CRITICAL, bad configuration?

Post by hsmith »

What do the permissions on your /usr/local/nagios/libexec directory look like? ls -l /usr/local/nagios/libexec
Former Nagios Employee.
me.
reynierpm
Posts: 20
Joined: Mon Aug 31, 2015 9:55 pm

Re: HTTP service gets CRITICAL, bad configuration?

Post by reynierpm »

Here:

Code: Select all

# ls -l /usr/local/nagios/libexec
total 5800
-rwxr-xr-x 1 nagios nagios 180378 Aug 31 20:53 check_apt
-rwxr-xr-x 1 nagios nagios   2309 Aug 31 20:53 check_breeze
-rwxr-xr-x 1 nagios nagios 183255 Aug 31 20:53 check_by_ssh
lrwxrwxrwx 1 root   root        9 Aug 31 20:53 check_clamd -> check_tcp
-rwxr-xr-x 1 nagios nagios 138601 Aug 31 20:53 check_cluster
-r-sr-xr-x 1 root   nagios 177049 Aug 31 20:53 check_dhcp
-rwxr-xr-x 1 nagios nagios 178225 Aug 31 20:53 check_dig
-rwxr-xr-x 1 nagios nagios 195820 Aug 31 20:53 check_disk
-rwxr-xr-x 1 nagios nagios   9348 Aug 31 20:53 check_disk_smb
-rwxr-xr-x 1 nagios nagios 194726 Aug 31 20:53 check_dns
-rwxr-xr-x 1 nagios nagios  87302 Aug 31 20:53 check_dummy
-rwxr-xr-x 1 nagios nagios   3542 Aug 31 20:53 check_file_age
-rwxr-xr-x 1 nagios nagios   6375 Aug 31 20:53 check_flexlm
lrwxrwxrwx 1 root   root        9 Aug 31 20:53 check_ftp -> check_tcp
-rwxr-xr-x 1 nagios nagios 283767 Aug 31 20:53 check_http
-r-sr-xr-x 1 root   nagios 183262 Aug 31 20:53 check_icmp
-rwxr-xr-x 1 nagios nagios 147251 Aug 31 20:53 check_ide_smart
-rwxr-xr-x 1 nagios nagios  15238 Aug 31 20:53 check_ifoperstatus
-rwxr-xr-x 1 nagios nagios  13386 Aug 31 20:53 check_ifstatus
lrwxrwxrwx 1 root   root        9 Aug 31 20:53 check_imap -> check_tcp
-rwxr-xr-x 1 nagios nagios   6947 Aug 31 20:53 check_ircd
-rwxr-xr-x 1 nagios nagios 159764 Aug 31 20:53 check_load
-rwxr-xr-x 1 nagios nagios   6595 Aug 31 20:53 check_log
-rwxr-xr-x 1 nagios nagios  22730 Aug 31 20:53 check_mailq
-rwxr-xr-x 1 nagios nagios 145337 Aug 31 20:53 check_mrtg
-rwxr-xr-x 1 nagios nagios 146574 Aug 31 20:53 check_mrtgtraf
-rwxr-xr-x 1 nagios nagios 159034 Aug 31 20:53 check_nagios
lrwxrwxrwx 1 root   root        9 Aug 31 20:53 check_nntp -> check_tcp
-rwxr-xr-x 1 nagios nagios 181138 Aug 31 20:53 check_nt
-rwxr-xr-x 1 nagios nagios 184885 Aug 31 20:53 check_ntp
-rwxr-xr-x 1 nagios nagios 176682 Aug 31 20:53 check_ntp_peer
-rwxr-xr-x 1 nagios nagios 172223 Aug 31 20:53 check_ntp_time
-rwxr-xr-x 1 nagios nagios 213167 Aug 31 20:53 check_nwstat
-rwxr-xr-x 1 nagios nagios   8926 Aug 31 20:53 check_oracle
-rwxr-xr-x 1 nagios nagios 161573 Aug 31 20:53 check_overcr
-rwxr-xr-x 1 nagios nagios 185006 Aug 31 20:53 check_ping
lrwxrwxrwx 1 root   root        9 Aug 31 20:53 check_pop -> check_tcp
-rwxr-xr-x 1 nagios nagios 188874 Aug 31 20:53 check_procs
-rwxr-xr-x 1 nagios nagios 158327 Aug 31 20:53 check_real
-rwxr-xr-x 1 nagios nagios   9642 Aug 31 20:53 check_rpc
-rwxr-xr-x 1 nagios nagios   1465 Aug 31 20:53 check_sensors
-rwxr-xr-x 1 nagios nagios 191184 Aug 31 20:53 check_smtp
-rwxr-xr-x 1 nagios nagios 156774 Aug 31 20:53 check_ssh
-rwxr-xr-x 1 nagios nagios 144169 Aug 31 20:53 check_swap
-rwxr-xr-x 1 nagios nagios 171082 Aug 31 20:53 check_tcp
-rwxr-xr-x 1 nagios nagios 159349 Aug 31 20:53 check_time
lrwxrwxrwx 1 root   root        9 Aug 31 20:53 check_udp -> check_tcp
-rwxr-xr-x 1 nagios nagios 169685 Aug 31 20:53 check_ups
-rwxr-xr-x 1 nagios nagios 139395 Aug 31 20:53 check_uptime
-rwxr-xr-x 1 nagios nagios 137241 Aug 31 20:53 check_users
-rwxr-xr-x 1 nagios nagios   2995 Aug 31 20:53 check_wave
drwxr-xr-x 4 nagios nagios   4096 Aug 31 20:45 eventhandlers
-rwxr-xr-x 1 nagios nagios 132332 Aug 31 20:53 negate
-rwxr-xr-x 1 nagios nagios 127118 Aug 31 20:53 urlize
-rwxr-xr-x 1 nagios nagios   1949 Aug 31 20:53 utils.pm
-rwxr-xr-x 1 nagios nagios   2791 Aug 31 20:53 utils.sh
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: HTTP service gets CRITICAL, bad configuration?

Post by hsmith »

What's the output of this when done from the command line?

/usr/local/nagios/libexec/check_http -H localhost
Former Nagios Employee.
me.
reynierpm
Posts: 20
Joined: Mon Aug 31, 2015 9:55 pm

Re: HTTP service gets CRITICAL, bad configuration?

Post by reynierpm »

hsmith wrote:What's the output of this when done from the command line?
/usr/local/nagios/libexec/check_http -H localhost
I've some VirtualHost defined on this server so here are my tests:

run the command above

Code: Select all

# /usr/local/nagios/libexec/check_http -H localhost
HTTP CRITICAL: HTTP/1.1 500 Internal Server Error - 801 bytes in 0.002 second response time |time=0.001728s;;;0.000000 size=801B;;;0
Change my VirtualHost to this:

Code: Select all

<VirtualHost *:80>
    ServerName admin.qa.pdone.com
    ServerAlias api.qa.pdone.com
    ServerAlias share.qa.pdone.com

    DocumentRoot /var/www/html/mt020415-00-pdonereptool/web
    <Directory /var/www/html/mt020415-00-pdonereptool/web>
        # enable the .htaccess rewrites
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>

    ErrorLog /var/log/httpd/pdone_error.log

    LogFormat "%h %l %t \"%r\" \"%{X-PDONE-SESSION-ID}i\" %>s %b" common
    CustomLog /var/log/httpd/pdone_access.log common
</VirtualHost>

<VirtualHost *:80>
    ServerName localhost
    ServerAlias xxx.xxxx.xxxx.xxx

    DocumentRoot /var/www/html
    <Directory /var/www/html>
        # enable the .htaccess rewrites
        AllowOverride All
        Order allow,deny
        Allow from All
    </Directory>
</VirtualHost>
Tried the same command again:

Code: Select all

# /usr/local/nagios/libexec/check_http -H localhost
HTTP WARNING: HTTP/1.1 403 Forbidden - 5159 bytes in 0.002 second response time |time=0.001546s;;;0.000000 size=5159B;;;0
I should check for this domains "admin.qa.pdone.com, api.qa.pdone.com, share.qa.pdone.com" I think, if they are alive then all should be good right? My concern around this is what happen if DNS fails and HTTP service still up & running, on this case check for HTTP server at localhost will be better, right?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: HTTP service gets CRITICAL, bad configuration?

Post by jdalrymple »

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.
Locked