nagios用默认带的spac文件编译成的rpm包,装上之后,nagios不能启动
[root@http2 nagios-2.10]# /etc/init.d/nagios start
starting nagios:config start aborted. check your nagios configuration.
|
通过查看配置文件之后发现因为找不到commands.cfg文件;
[root@http2 nagios-2.10]# /usr/sbin/nagios -v /etc/nagios/nagios.cfg
nagios 2.10
凯发app官方网站 copyright (c) 1999-2007 ethan galstad (http://www.nagios.org)
last modified: 10-21-2007
license: gpl
reading configuration data...
error: cannot open config file '/etc/nagios/commands.cfg' for reading: no such file or directory
***> one or more problems was encountered while processing the config files...
check your configuration file(s) to ensure that they contain valid
directives and data defintions. if you are upgrading from a previous
version of nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. make sure to read
the html documentation regarding the config files, as well as the
'whats new' section to find out what has changed.
[root@http2 nagios-2.10]#
|
而我直接用源码configure;make;make fullinstall装上的,就可以正常使用。
说明问题是:spac文件中对默认配置文件的处理有问题,编译成的rpm包中只有:
/etc/nagios
/etc/nagios/cgi.cfg
/etc/nagios/nagios.cfg
/etc/nagios/resource.cfg
|
而configure;make;make fullinstall装上的默认有
[root@lvs191 etc]# ll /usr/local/nagios/etc/
total 76
-rw-rw-r-- 1 nagios nagios 9583 mar 14 10:34 cgi.cfg
-rw-rw-r-- 1 nagios nagios 8582 mar 14 10:34 commands.cfg
-rw-rw-r-- 1 nagios nagios 12469 mar 14 10:34 localhost.cfg
-rw-rw-r-- 1 nagios nagios 31135 mar 14 10:34 nagios.cfg
-rw-rw---- 1 nagios nagios 1339 mar 14 10:34 resource.cfg
|
看来有两个文件被忘记了,commands.cfg和localhost.cfg。这两个文件,应该来源于源码包中的sample-config/template-object/目录下
[root@lvs191 nagios-2.10]# ls -r sample-config/
sample-config/:
readme cgi.cfg.in httpd.conf.in mrtg.cfg.in nagios.cfg.in resource.cfg.in
cgi.cfg httpd.conf mrtg.cfg nagios.cfg resource.cfg template-object
sample-config/template-object:
readme commands.cfg commands.cfg.in localhost.cfg localhost.cfg.in
|
然后查看spac文件中对配置文件的处理部分
# install templated configuration files
cd sample-config
for f in {nagios,cgi}.cfg ; do
[ -f $f ] && install -c -m 664 $f ${rpm_build_root}/etc/nagios/${f}
done
for f in resource.cfg ; do
[ -f $f ] && install -c -m 664 $f ${rpm_build_root}/etc/nagios/${f}
done
cd template-object
for f in {hosts,hostgroups,services,contacts,contactgroups,dependencies,escalations,timeperiods,checkcommands,misccommands,minimal}.cfg
do
[ -f $f ] && install -c -m 664 $f ${rpm_build_root}/etc/nagios/${f}
done
|
的确对所有可能配置文件都做了处理,但是单单没有处理commands.cfg和localhost.cfg。那么更改spac文件,把commands.cfg和localhost.cfg加到里面
# install templated configuration files
cd sample-config
for f in {nagios,cgi}.cfg ; do
[ -f $f ] && install -c -m 664 $f ${rpm_build_root}/etc/nagios/${f}
done
###mkdir -p ${rpm_build_root}/etc/nagios/private
for f in resource.cfg ; do
[ -f $f ] && install -c -m 664 $f ${rpm_build_root}/etc/nagios/${f}
done
cd template-object
for f in {commands,localhost,hosts,hostgroups,services,contacts,contactgroups,dependencies,escalations,timeperiods,checkcommands,misccommands,minimal}.cfg
do
[ -f $f ] && install -c -m 664 $f ${rpm_build_root}/etc/nagios/${f}
done
|
重新编译成rpm包,装上正常了,可以启动nagios。但是spac文件是否还有别的问题,还待测试。下面测试plugins。
阅读(1578) | 评论(0) | 转发(0) |