Page 1 of 2

check_http 404 not found

Posted: Fri Sep 29, 2017 2:35 pm
by nickanderson82
Nagios server cfg file is:
# Define 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 xxx.xxx.com
alias xxx.xxx.com
address xxx.xxx.com
}

###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################

# Define a service to "ping" the local machine

define service{
use generic-service ; Name of service template to use
host_name xxx.xxx.com
service_description PING
check_command check_ping!100.0,20%!500.0,60% -4
}

# 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 generic-service ; Name of service template to use
host_name xxx.xxx.com
service_description HTTP
check_command check_http
notifications_enabled 0
}

-------

Nagios status information displays warning:
HTTP WARNING: HTTP/1.1 404 Not Found - 492 bytes in 5.007 second response time

I am not sure what the check_command edit should be or if i need to look elsewhere. The ping works as intended

Re: check_http 404 not found

Posted: Fri Sep 29, 2017 2:42 pm
by kyang
Try doing this

Code: Select all

vi /var/www/html/index.html
in the index.html add this

Code: Select all

<HTML>
<BODY>
Nagios Server
</BODY>
</HTML>
save the file

Code: Select all

:wq

Code: Select all

chmod 755 /var/www/html/index.html
chown apache:apache /var/www/html/index.html
service httpd restart
Does this solve the http error on localhost?

Re: check_http 404 not found

Posted: Fri Sep 29, 2017 2:50 pm
by nickanderson82
What exactly is that changing? I don't want to affect something that doesn't need to be changed

That HTTP WARNING: HTTP/1.1 404 Not Found - 492 bytes in 5.007 second response time
/\/\/\ That is listed in the status on my nagios page

Its like the check_command for check_http is wrong in my cfg file

Re: check_http 404 not found

Posted: Fri Sep 29, 2017 2:52 pm
by dwhitfield
We'd need to see how the command is defined, probably in the commands.cfg.

Re: check_http 404 not found

Posted: Fri Sep 29, 2017 2:57 pm
by nickanderson82
# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}

Re: check_http 404 not found

Posted: Fri Sep 29, 2017 3:29 pm
by dwhitfield
Please run /usr/local/nagios/libexec/check_http xxx.xxx.com and post the output here in a code block.

Also, can you PM me the URL so I can test it?

Re: check_http 404 not found

Posted: Fri Sep 29, 2017 3:36 pm
by nickanderson82
I pm-ed the url

but I get
HTTP WARNING: HTTP/1.1 404 Not Found - 492 bytes in 0.007 second response time |time=0.006990s;;;0.000000 size=492B;;;0

Re: check_http 404 not found

Posted: Mon Oct 02, 2017 8:36 am
by nickanderson82
Any ideas?

Re: check_http 404 not found

Posted: Mon Oct 02, 2017 10:53 am
by kyang
@dwhitfield has informed me with your url.

It seems to work when using the -H for host address instead of -I for IP address.

Code: Select all

/usr/local/nagios/libexec/check_http -H xxx.xxx.com
Output

Code: Select all

HTTP OK: HTTP/1.1 302 Found - 501 bytes in 0.182 second response time |time=0.182388s;;;0.000000 size=501B;;;0

Re: check_http 404 not found

Posted: Mon Oct 02, 2017 11:46 am
by nickanderson82
Should I change it to:
# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -H $HOSTADDRESS$ $ARG1$
}

Instead of the -I