首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >nconf无法生成nagios配置文件。

nconf无法生成nagios配置文件。
EN

Server Fault用户
提问于 2014-04-30 01:41:50
回答 3查看 4.8K关注 0票数 2

我安装了一个全新的nagios服务器,并安装了一个新的nconf。我只需要看看nconf如何为ngaios生成配置文件。

但是,在单击Generate配置后,我得到:

代码语言:javascript
复制
Nagios Core 4.0.5
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 04-11-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Error: Cannot open main configuration file '/opt/htdocs/nconf/temp/test/Default_Collector.cfg' for reading!
Error processing main config file!

我以为nconf是生成文件,但它想读取一个文件。我不知道我应该提供给nconf什么文件。太困惑了,需要帮助。

但是Default_Collector.cfg文件不存在。没有这样的目录/opt/htdocs/nconf/temp/test/。空在/opt/htdocs/nconf/temp/

编辑:权限设置

代码语言:javascript
复制
[root@localhost nconf]# ll |grep ^d
drwxr-xr-x 2 apache root    4096 Dec 11  2011 ADD-ONS
drwxr-xr-x 3 apache root    4096 Dec 11  2011 bin
drwxrwxr-x 2 apache apache  4096 Apr 30 11:14 config
drwxr-xr-x 2 apache root    4096 Dec 11  2011 config.orig
drwxr-xr-x 3 apache root    4096 Dec 11  2011 design_templates
drwxr-xr-x 3 apache root    4096 Dec 11  2011 img
drwxr-xr-x 9 apache root    4096 Dec 11  2011 include
drwxrwxr-x 2 apache apache  4096 Apr 30 11:28 output
drwxrwxr-x 2 apache apache  4096 Dec 11  2011 static_cfg
drwxrwxr-x 2 apache apache  4096 Apr 30 11:29 temp
[root@localhost nconf]# ps -ef|grep apache
root     15568 15528  0 10:14 pts/0    00:00:00 grep apache
apache   26125     1  0 Apr29 ?        00:00:01 /usr/local/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
apache   26126 26125  0 Apr29 ?        00:00:00 /usr/bin/php-cgi
apache   26127 26126  0 Apr29 ?        00:00:15 /usr/bin/php-cgi
EN

回答 3

Server Fault用户

发布于 2015-12-16 23:38:50

是啊,帮我想清楚了。在我的例子中,这是一个全新的CentOS 6.8安装,所有的默认或epel包都是通过yum安装的(系统没有手动运行)。

无论如何,支持perl脚本nconf/bin/generateconfig.pl至少有两个perl包依赖项,我丢失了并且失败了。虽然运行generate_config.pl的包装器脚本试图检测失败,但它没有看到perl脚本中的错误,因此包装器脚本继续运行,并基本上尝试从零开始创建一个新的nagios配置(因为generate_config.pl没有生成任何内容),因此出现了这个错误。

运行yum install perl-DBI perl-DBD-MySQL为我解决了问题,但也可能是其他缺少的perl包,或者包装器脚本无法识别的与generate_config.pl不同的错误。我的建议是尝试像sudo -u apache /opt/nconf/bin/generate_config.pl一样手动运行perl脚本。一旦完成了这部分工作,在web nconf应用程序允许您生成另一个配置集之前,您需要清除/opt/nconf/temp文件夹。

祝好运!

票数 2
EN

Server Fault用户

发布于 2014-04-30 03:19:24

确保用户nconf可以写入以下目录。

代码语言:javascript
复制
/opt/htdocs/nconf/config 
/opt/htdocs/nconf/output 
/opt/htdocs/nconf/static_cfg 
/opt/htdocs/nconf/temp
票数 0
EN

Server Fault用户

发布于 2020-09-15 17:26:13

对于当前的Ubuntu18.04,这似乎是由于当前perl (5.26.1)不允许将散列用作引用造成的,如https://stackoverflow.com/questions/11044211/using-hash-as-a-reference-is-deprecated中所述:

Can't use a hash as a reference at /var/www/nconf/bin/lib/NConf/ExportNagios.pm line 1274.

通过手动运行generate_config.pl,您可以看到更多的错误( web生成器并没有真正说明发生了什么),如下所示:sudo -u www-data bin/generate_config.pl

关于可能的修复的提示在https://github.com/nconf/nconf/issues/37中。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/592170

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档