免费注册 查看新帖 |

Chinaunix

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

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

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-05-11 06:34 |只看该作者 |倒序浏览
本帖最后由 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.


这个问题我发表在了freebsd区,但是貌似没人回答我。

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

论坛徽章:
0
2 [报告]
发表于 2010-05-11 07:37 |只看该作者
我应该从什么方面排解错误呢?

论坛徽章:
0
3 [报告]
发表于 2010-05-11 07:49 |只看该作者
非常抱歉,标题打错了,不应该是说404错误。
其实标题应该写成
Error: Could not open main config file '/usr/local/test/etc/nagios.cfg' for reading!

抱歉

论坛徽章:
381
CU十二周年纪念徽章
日期:2014-01-04 22:46:58CU大牛徽章
日期:2013-03-13 15:32:35CU大牛徽章
日期:2013-03-13 15:38:15CU大牛徽章
日期:2013-03-13 15:38:52CU大牛徽章
日期:2013-03-14 14:08:55CU大牛徽章
日期:2013-04-17 11:17:19CU大牛徽章
日期:2013-04-17 11:17:32CU大牛徽章
日期:2013-04-17 11:17:37CU大牛徽章
日期:2013-04-17 11:17:42CU大牛徽章
日期:2013-04-17 11:17:47CU大牛徽章
日期:2013-04-17 11:17:52CU大牛徽章
日期:2013-04-17 11:17:56
4 [报告]
发表于 2010-05-11 07:52 |只看该作者
配置文件应该是/usr/local/nagios/etc/nagios.cfg吧.

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

论坛徽章:
0
6 [报告]
发表于 2010-05-11 08:12 |只看该作者
多谢chenyx ,的确是我搞错了
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP