1、安装完nagios及nagios-plugins时,卡在这了,forbidden 禁止访问

apache日志显示如下

Directory index forbidden by Options directive: /usr/local/nagios/share/

1、apache的配置问题默认页面是否是index.php,还有是否支持php模块(ll /etc/httpd/conf.d/php.conf

2、相应目录的权限问题 是否可读

3、是否正确配置的账户验证,

如下示例:

配置http验证 【配置验证时注意验证用户的名字,建议为nagiosadmin,不然就记得修改cgi.cfg及contact.cfg保持账号的一致,不然就会遇到下面的错误5.】

两种方式

第一种方式,在安装nagios的时候,直接makeinstall –webconf

这个会在/etc/httpd/conf.d/生成一个nagios.conf文件

htpasswd-c /etc/nagios/htpasswd.users  nagiosadmin

第二种方式

直接自行配置nagioshttp验证,可直接在主配置文件nagios.conf中添加如下

ScriptAlias/nagios/cgi-bin /usr/local/nagios/sbin

Options ExecCGI

AllowOverride None

Order allow,deny

Allow from all

AuthName "Nagios Access"

AuthType Basic

AuthUserFile/etc/nagios/htpasswd

//用于此目录访问身份验证的文件

Require valid-user


Alias /nagios/usr/local/nagios/share

Options None

AllowOverride None

Order allow,deny

Allow from all

AuthName "Nagios Access"

AuthType Basic

AuthUserFile/etc/nagios/htpasswd

#//用于此目录访问身份验证的文件

Require valid-user

htpasswd-c /etc/nagios/htpasswdnagios

2、The requested URL/nagios/cgi-bin/statusmap.cgi was not found on this server.

nagios监控故障排除_第1张图片

没有map图形,

yuminstall gd-devel -y

重新编译,

若是源码安装gd-devel,需要手动来指明gd-lib的存放,通过yum安装的不需要,可以自动加载到

./configure --with-gd-lib=/usr/lib  --with-gd-inc=/usr/include

make install; makeinstall-init; make install-config; make install-commandmode; make install-webconf

重启nagios服务


3、错误:

Error: Service check command'check_nrpe' specified in service 'check_total_procs' for host '192.168.15.183'not defined anywhere!

没有定义nagios的命令模板

编辑commands.cfg 添加即可

例:define command {
       command_name  check_nrpe
       command_line     $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}


4、安装nrpe,编译的时候提示以下信息checkingfor SSL headers... configure: error: Cannot find ssl headers原因是缺少openssl-devel包,yum -yinstall openssl-devel 问题解决!


5It appears as thoughyou do not have permission to view information for any of the hosts yourequested...

If you believe this is an error, check the HTTP serverauthentication requirements for accessing this CGI
and check the authorization options in your CGI configuration file.

解决:

第一种:

配置cgi.cfg

78 use_authentication=1默认值为1,改为0,即取消账号验证

第二种:同样也是配置cgi.cfg中的参数,

在末行模式下执行 %s/nagiosadmin/username/g

username是你在htpasswd生成的自定义验证用户


开启认证认证的用户必须是 cgi.cfg 配置文件里有的默认是 nagiosadmin
  如果你新建的其他用户需要添加进去多用户用逗号分开
   authorized_for_system_information=nagiosadmin
   authorized_for_configuration_information=nagiosadmin
   authorized_for_system_commands=nagiosadmin
   authorized_for_all_services=nagiosadmin
   authorized_for_all_hosts=nagiosadmin
   authorized_for_all_service_commands=nagiosadmin
   authorized_for_all_host_commands=nagiosadmin
  如果不是 nagiosadmin 需要到后面添加
  例子 authorized_for_system_information=nagiosadmin,username


愿积极跟贴,共建nagios故障解决手册。。。。