Nagios - HTTP警告:HTTP / 1.1 403禁止

时间:2014-05-15 08:55:19

标签: nagios

我正在使用Nagios XI。我输入以下命令以监视远程Linux服务器的httpd服务(128.19.5.131):

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

它给了我以下输出:

HTTP WARNING: HTTP/1.1 403 Forbidden

8 个答案:

答案 0 :(得分:8)

您可以输入用户名/密码,并通过-e告诉nagios可以期待什么。在任何情况下都不必授权,并且拥有WARNING并不重要。

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

<强>更新

您获得forbidden的原因是您没有任何索引文件,并且禁用了目录列表。您可以创建一个文件nagios.txt(不放入任何内容),让nagios获取该文件而不是不允许查看的目录。

答案 1 :(得分:6)

我通过执行

解决了这个问题
$ touch /var/www/html/index.html
$ chmod 755 /var/www/html/index.html

在远程服务器上。

答案 2 :(得分:1)

我在远程Linux机器的index.html目录中创建了一个名为/var/www/html的文件(128.19.5.131)。使用service httpd restart重新启动HTTP服务,然后执行相同的命令,

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

我得到了以下输出:

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

我不知道在每个要监控的主机的index.html目录中添加/var/www/html文件是否合适,但它在Nagios XI控制台中显示了所需的结果。

答案 3 :(得分:0)

说明在:

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

答案 4 :(得分:0)

您可以添加如下所示的行:

# '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$'
        }

/etc/nagios-plugins/config/http.cfg ,然后在服务器配置文件中更改 check_http_80 check_http_80 。< / p>

然后重新启动nagios服务器。

答案 5 :(得分:0)

我做到了,而且效果很好!!请遵循以下命令:

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

谢谢!

答案 6 :(得分:-1)

CentOS 8 2004 NREP客户端上,由Nagios Ubuntu 20.04 Server 监视。使用命令touch /var/www/html/index.html chmod 755 /var/www/html/index.html Centos 8 /var/www/html/目录应填充index.html。之后,从Ubuntu Nagios Server运行命令/usr/lib/nagios/plugins/check_nrpe -H 10.0.0.20 -c check_http,结果为HTTP OK:

答案 7 :(得分:-1)

触摸 /var/www/html/index.html

这对我来说很有效。