免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2678 | 回复: 1
打印 上一主题 下一主题

nagios Could not open main config file nagios.cfg' for reading! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-05-11 03:07 |只看该作者 |倒序浏览
本帖最后由 intgoo 于 2010-05-11 07:51 编辑

首先简单介绍下我的环境。
freebsd7.2+apache2.2+php5.2+gd2.0+zned2.2

http.conf中有
ScriptAlias /nagios/cgi-bin/ /usr/local/nagios/sbin/
<Directory "/usr/local/nagios/sbin/">
    Options ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all
    AuthName  "Nagios Access"
    AuthType Basic     
    AuthUserFile /usr/local/nagios/etc/htpasswd
    Require valid-user
</Directory>


Alias /nagios /usr/local/nagios/share
<Directory "/usr/local/nagios/share">
    Options None
    AllowOverride None
    Order allow,deny  
    Allow from all
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /usr/local/nagios/etc/htpasswd
    Require valid-user
</Directory>

然后还设置了hosts.cfg 、services.cfg 、contacts.cfg等
这是services.cfg的内容
define service{
        host_name               xp-test

        service_description     check-host-alive

        check_command           check-host-alive

        max_check_attempts      5
        normal_check_interval   3
        retry_check_interval    2
        check_period            24x7

        notification_interval   10
        notification_period     24x7

        notification_options    w,u,c,r

        contact_groups          admins

        }
这是hosts.cfg的内容
define service{
        host_name               xp-test

        service_description     check-host-alive

        check_command           check-host-alive

        max_check_attempts      5
        normal_check_interval   3
        retry_check_interval    2
        check_period            24x7

        notification_interval   10
        notification_period     24x7

        notification_options    w,u,c,r

        contact_groups          admins

        }
contacts.cfg和contactgroups.cfg都设置正确了
用/path/nagios -v /path/nagios.cfg检查

Total Warnings: 0
Total Errors:   0


/path/nagios -d /path/nagios.cfg启动没错误,日志是下面的内容
[1273508523] Nagios 3.2.1 starting... (PID=35196)
[1273508523] Local time is Tue May 11 00:22:03 CST 2010
[1273508523] LOG VERSION: 2.0
[1273508523] Finished daemonizing... (New PID=35197)


打开http://ip/nagios输入用htpasswd生成的密码能正常访问,但打开一下的项目时候都显示
Whoops!
Error: Could not open main config file '/usr/local/test/etc/nagios.cfg' for reading!

Here are some things you should check in order to resolve this error:


Make sure you've installed a main config file in its proper location. See the error message about for details on where the CGI is expecting to find the configuration file. A sample main configuration file (named nagios.cfg) can be found in the sample-config/ subdirectory of the Nagios source code distribution.
Make sure the user your web server is running as has permission to read the main config file.

Make sure you read the documentation on installing and configuring Nagios thoroughly before continuing. If all else fails, try sending a message to one of the mailing lists. More information can be found at http://www.nagios.org.



最后不补充下nagios目录是u=nagios , g=nagios。另外www用户属于nagios组
nagios:*:1002:www,权限是755.


              求解~~~
不论是大侠还是路人,知道的帮忙排解下。或者帮顶下 。 多谢各位先

论坛徽章:
0
2 [报告]
发表于 2010-05-11 08:11 |只看该作者
我晕了,找了半天的错误,原来是有次做试验的时候把cgi.cfg中的nagios全换成了test。看来认识实在是太重要了,前次的404错误也是httpd.conf多写了个引号
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP