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
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。
阅读(1727) | 评论(0) | 转发(0) |