Chinaunix首页 | 论坛 | 博客
  • 博客访问: 57701
  • 博文数量: 20
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 252
  • 用 户 组: 普通用户
  • 注册时间: 2014-06-11 14:27
文章分类

全部博文(20)

文章存档

2014年(20)

我的朋友

分类: LINUX

2014-07-29 10:38:54

看了一篇有关Nagios的文档,里面一系列的安装,让我头疼不已!那就说说我安装过程中所遇见的错误吧!
    
        当刚刚安装完基础插件的时候,我去安装nagios,到编译 make all的时候提示下列错误
[root@localhost nagios]# make all
cd ./base && make
make[1]: Entering directory `/root/nagios/base'
make[1]: *** No rule to make target `../include/locations.h', needed by `broker.o'.  Stop.
make[1]: Leaving directory `/root/nagios/base'
make: *** [all] Error 2
这个问题的解决方法是:执行 yum -y install perl 后再./configure 即可正常编译安装


         问题就是安装php-5.5.14时候所遇见的错误:
            checking libxml2 install dir... no
            checking for xml2-config path... 
            configure: error: xml2-config not found. Please check your libxml2 installation.
          检查libxml2的安装发现少了一个包,所有要安装libxml2-python,只要用yum 安装就好了!
        [root@kc ~]# rpm -qa | grep libxml2
                            libxml2-2.7.6-14.el6_5.2.i686

        安装完成后,我们需要去检查一下:
        [root@kc php-5.5.14]# find / -name "xml2-config"
        /usr/bin/xml2-config
        然后需要重新编译安装的话直接:./configure 就好了

在安装PHP的时候到最后会报错 
configure: error: xml2-config not found. Please check your libxml2 installation.
可以判定是xml2没有安装好! 我们可以重新安装一遍
[root@k2 ~]# yum install libxml2
root@k2 ~]# yum install libxml2-devel -y

安装好了PHP ,当我们去做测试页的时候“”却发现输入的这个地址后,系统提示要下载,这个问题呢,搞了我好长时间才知道,原因是没有发布成功,这就需要到httpd.conf中的

    DirectoryIndex index.html index.php

这里去添加,有时候这样的添加也是没有的! 那么就需要把它们的名字改一下,在网站根目录,把index.html 改成index.php,重新启动httpd,之后就会发现网页可以访问了!然后从新更改过来就好! 
                    ps.有的时候 这样改也不行 可能是由于版本问题 你需要在http.conf中找LoadModule php5_module e:/php5.2.5/php5apache2_2.dll 这个注释掉
        
今天在安装Nagios的时候,中间会用用到Aptech,所以就安装了一下, 刚开始的时候安装的还挺顺的,只是到后面在访问Apache的时候提示403错误,查看了几次的配置文件——httpd.conf 都没发现错误!
    结果在往回测试的时候发现在nagios的安装目录中——usr/local/nagios,没有bin这个选项,那么排除其他的问题,那就把这个bin给找回来!

        *下载好nagios之后,解压 
        #tar zxvf nagios-3.4.3.tar.gz
        
# cd nagios
        
# ./configure --prefix=/usr/local/nagios
        *然后就一路编译,安装就好了
        
# make all # make install    

        # make install-init

        # make install-commandmode

        # make install-config

        # chkconfig --add nagios

        # chkconfig --level 35 nagios on

        # chkconfig --list nagios

        现在安装完了,我们需要去验证一下,安装的是否是正确的:
            在安装目录/usr/local/nagios下,去检查一下有没有  : etc、bin、sbin、share、var 这五个目录
        然后再用这个明天检查一下,有没有错误: /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

        然后到这里,如果发现/usr/local/nagios 中有bin的话,那么就可以去实验一下,在其他机器上去输入: 这样就可以访问了

        通常在这里会有一个错误:
        http:Could not reliably determine the server's fully qualified domain name , using : :1 for ServerName
        这里通常是由于主配置文件中,ServerName 的问题,只要把前面的注释掉,重新写一个localhost就好了
        #ServerAdmin you@example.com
        ServerName localhost:80


安装好了Nagios后,我们通常要去检查配置是否是正确的:
    #/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
         结果报一下的错误

 Running pre-flight check on configuration data...


Checking services...
Error: Contact group 'admins' specified in service 'Current Load' for host 'localhost' is not defined anywhere!
Error: Contact group 'admins' specified in service 'Current Users' for host 'localhost' is not defined anywhere!
Error: Contact group 'admins' specified in service 'HTTP' for host 'localhost' is not defined anywhere!
Error: Contact group 'admins' specified in service 'PING' for host 'localhost' is not defined anywhere!
Error: Contact group 'admins' specified in service 'Root Partition' for host 'localhost' is not defined anywhere
Error: Contact group 'admins' specified in service 'SSH' for host 'localhost' is not defined anywhere!
Error: Contact group 'admins' specified in service 'Swap Usage' for host 'localhost' is not defined anywhere!
Error: Contact group 'admins' specified in service 'Total Processes' for host 'localhost' is not defined anywher
Error: Contact group 'admins' specified in service 'C:\ Drive Space' for host 'winserver' is not defined anywher
Error: Contact group 'admins' specified in service 'CPU Load' for host 'winserver' is not defined anywhere!
Error: Contact group 'admins' specified in service 'Explorer' for host 'winserver' is not defined anywhere!
Error: Contact group 'admins' specified in service 'Memory Usage' for host 'winserver' is not defined anywhere!
Error: Contact group 'admins' specified in service 'NSClient++ Version' for host 'winserver' is not defined anyw
Error: Contact group 'admins' specified in service 'Uptime' for host 'winserver' is not defined anywhere!
Error: Contact group 'admins' specified in service 'W3SVC' for host 'winserver' is not defined anywhere!
Checked 15 services.
Checking hosts...
Error: Contact group 'admins' specified in host 'localhost' is not defined anywhere!
Error: Contact group 'admins' specified in host 'winserver' is not defined anywhere!

看到这里就有点蒙了,但我看到关键字是——group 'admins' 而又关于的是服务,那么就只能一一查找了,我在网上搜了一下,说是要更改“将templates.cfg配置中的admins组更改为contact.cfg中定义的contactgroup_name      ts ”
    或者是services.cfg中的组,我进去看了一下,都没什么问题,最后我在 contact.cfg中 把
联系组有 ts 更改为了 admins,然后再测试了一下就好了!
define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 David
        }



阅读(1374) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~