check_http 404 not found

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.
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

check_http 404 not found

Post 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
kyang

Re: check_http 404 not found

Post 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?
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

Re: check_http 404 not found

Post 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
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_http 404 not found

Post by dwhitfield »

We'd need to see how the command is defined, probably in the commands.cfg.
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

Re: check_http 404 not found

Post by nickanderson82 »

# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: check_http 404 not found

Post 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?
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

Re: check_http 404 not found

Post 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
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

Re: check_http 404 not found

Post by nickanderson82 »

Any ideas?
kyang

Re: check_http 404 not found

Post 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
nickanderson82
Posts: 29
Joined: Wed Sep 27, 2017 11:27 am

Re: check_http 404 not found

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