免费注册 查看新帖 |

Chinaunix

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

nagios编译成可用的rpm安装包 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-03-14 11:20 |只看该作者 |倒序浏览
    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。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/43502/showart_495981.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP