nagios编译成可用的rpm安装包-凯发app官方网站

凯发app官方网站-凯发k8官网下载客户端中心 | | 凯发app官方网站-凯发k8官网下载客户端中心
  • 博客访问: 2018286
  • 博文数量: 220
  • 博客积分: 8531
  • 博客等级: 中将
  • 技术积分: 4976
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-18 13:33
文章分类

全部博文(220)

文章存档

2017年(1)

2015年(1)

2014年(5)

2013年(6)

2012年(6)

2011年(30)

2010年(37)

2009年(53)

2008年(41)

2007年(40)

相关博文
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·
  • ·

分类: linux

2008-03-14 11:20:47

    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) |
0

上一篇:nagios编译插曲

下一篇:nagios的nrpe插件

给主人留下些什么吧!~~
")); function link(t){ var href= $(t).attr('href'); href ="?url=" encodeuricomponent(location.href); $(t).attr('href',href); //setcookie("returnouturl", location.href, 60, "/"); }
网站地图