Question

I am using Nagios XI. I entered following command in order to monitor httpd service of the remote Linux server (128.19.5.131):

/usr/local/nagios/libexec/check_http -H 128.19.5.131

It is giving me following output:

HTTP WARNING: HTTP/1.1 403 Forbidden

Was it helpful?

Solution 3

I created a file with name index.html in the /var/www/html directory of the remote Linux machine (128.19.5.131). Restarted the HTTP service with service httpd restart and then executed the same command, i.e. :

nagiossrv root [libexec] >/usr/local/nagios/libexec/check_http -H 128.19.5.131

I got following output:

HTTP OK HTTP/1.1 200 OK - 250 bytes in 0.001 seconds |time=0.000977s;;;0.000000 size=250B;;;0

I do not know whether it is proper to add index.html file in the /var/www/html directory of each host to be monitored or not, but it is showing desired results in the Nagios XI console.

OTHER TIPS

I solved it by executing

$ touch /var/www/html/index.html
$ chmod 755 /var/www/html/index.html

on the remote server.

You can put a username/password and tell nagios what to expect via -e. It is not a must to authorize in any case and it is also not critical to have a WARNING.

 /usr/local/nagios/libexec/check_http -H 128.19.5.131 -e 'HTTP' --authorization=username:password

Update:

The reason why you get forbidden is because you don't have any index file and directory listing is disabled. You can create a file nagios.txt (without putting anything in) and let nagios fetch that file instead of a directory which it is not allowed to view.

Explanation is in:

vim /etc/httpd/conf.d/welcome.conf
# 
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL.  To disable the Welcome page, comment
# out all the lines below.
#
<LocationMatch "^/+$">
#Options -Indexes                        #<----- comment out this line
#ErrorDocument 403 /error/noindex.html   #<----- comment out this line
</LocationMatch>
$ service httpd restart

You can add a line like this:

# 'check_http_80' command definition
define command{
        command_name    check_http_80
        command_line    /usr/lib/nagios/plugins/check_http -H '$HOSTADDRESS$':80 -I '$HOSTADDRESS$'
        }

to your /etc/nagios-plugins/config/http.cfg and change check_http for check_http_80 in your server configuration file.

Then restart you nagios server.

i did this and it works perfectly !! follow these commands:

touch /var/www/html/index.html
chmod 755 /var/www/html/index.html
systemctl nagios restart
systemctl httpd restart

Thanks !

On CentOS 8 2004 NREP client, Monitored by Nagios Ubuntu 20.04 Server. Use commands touch /var/www/html/index.html chmod 755 /var/www/html/index.html The Centos 8 /var/www/html/ directory should be populated with index.html. After that from Ubuntu Nagios Server run command /usr/lib/nagios/plugins/check_nrpe -H 10.0.0.20 -c check_http the results HTTP OK:

touch /var/www/html/index.html

This just worked in my case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top