• nagios安装


    环境:vmware workstation虚拟机,server:192.168.118.128  

    server环境:centos-6.6 nagios-4.1.1  httpd-2.4.20  php-5.6.22

    server安装:

       useradd nagios  创建用户
       mkdir /usr/local/nagios
       chown -R nagios:nagios /usr/local/nagios
       tar -xzvf nagios-4.1.1.tar.gz.gz 
       cd nagios-4.1.1
       ll
       ./configure --prefix=/usr/local/nagios
       make all
       yum install unzip
       make all
       make install
       make install-init
       make install-commandmode
       make install-config
       chkconfig --add nagios
       chkconfig --level 35 nagios on
       chkconfig --list nagios
       cd ..
       rz
       ll
       tar -xzvf nagios-plugins-2.1.1.tar.gz #插件安装包
       tar -xzvf nagios-cn-3.2.3.tar.bz2 
       ll
       rm nagios-cn-3.2.3.tar.bz2
       ll
       rz
       ll
       tar -jxvf nagios-cn-3.2.3.tar.bz2   #汉化安装包
       cd nagios-cn-3.2.3
       ll
       ./configure 
       make all
       make install
       cd ..
       ll
       mkdir /usr/local/apache2
       tar -zxvf httpd-2.4.20.tar.gz 
       cd httpd-2.4.20
       ./configure --prefix=/usr/local/apache2
       ll
       vi README
       more INSTALL 
       ./configure --prefix=/usr/local/apache2
       find / -name apr
       find / -name APR
       find / -name apr*  #Apr库支持
       yum search apr
       yum install apr.x86_64 apr-util.x86_64
       yum remove httpd
       ./configure --prefix=/usr/local/apache2
       cd ..
       ll
       wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
       ll
       rm apr-1.4.5.tar.gz 
       rz
       ll
       tar -zxvf apr-1.5.2.tar.gz 
       tar -zxvf apr-util-1.5.4.tar.gz 
       tar -zxvf pcre-8.38.tar.gz 
       cd apr-1.5.2
       ./configure --prefix=/usr/local/apr
       make && make install
       cd ..
       cd apr-util-1.5.4
       ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config 
       make && make install
       cd ..
       cd pcre-8.38
       ./configure --prefix=/usr/local/pcre
       make && make install
       cd ..
       cd httpd-2.4.20
       ./configure --prefix=/usr/local/apache2 --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
       make 
       make install
       cd ..
       ll
       tar -zxvf php-5.6.22.tar.gz 
       mkdir /usr/local/php
       cd php-5.6.22
       ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs 
       yum install libxml2
       find / -name libxml2
       find / -name libxml2*
       find / -name xml2-config
       yum install libxml2-devel
       find / -name xml2-config
       ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs
       make
       make test
       make install
    cp php.ini-development /usr/local/lib/php.ini #php配置

      

    配置apache,文件位置:usr/local/apache2/conf/http.conf

    将进程启动用户改为nagios,即:

    User  nagios

    Group nagios

    LoadModule php5_module        modules/libphp5.so  # 去掉此行前面注释

    找到DirectoryIndex 增加 index.php

    并新增SetHandler application/x-httpd-php 使其支持解析php

    在最后新增nagios配置:

    ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
    <Directory "/usr/local/nagios/sbin">
         AuthType Basic
         Options ExecCGI
         AllowOverride None
         Order allow,deny
         Allow from all
         AuthName "Nagios Access"
         AuthUserFile /usr/local/nagios/etc/htpasswd
         Require valid-user
    </Directory>
    Alias /nagios "/usr/local/nagios/share"
    <Directory "/usr/local/nagios/share">
         AuthType Basic
         Options None
         AllowOverride None
         Order allow,deny
         Allow from all
         AuthName "nagios Access"
         AuthUserFile /usr/local/nagios/etc/htpasswd
         Require valid-user
    </Directory>

    因为指定了访问验证文件,所以需要创建一个:

    /usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd 【登录用户名自己设置】回车后输入设置的密码即可

    设置完成可以启动nagios和apache了

    出现的问题:

    本地可访问,局域网内其他主机不可访问,报no router,此时是防火墙挡住了,可以关掉server防火墙:service iptables stop 或者新增一条放开监听端口80(http.conf)的规则:iptables -I INPUT -p tcp --dport 80 -j ACCEPT

    到此server安装完成,当然为了监控其他主机还需要配置相应的nagios文件。

  • 相关阅读:
    spring相关记录
    xshell不能连接VM中的ubuntu
    MySQL 获得当前日期时间(以及时间的转换)
    struts2 action获取ajax提交数据中文乱码问题
    Write operations are not allowed in read-only mode (FlushMode.NEVER/
    在Action中以Struts2的方式输出JSON数据
    javascript 对象数组排序
    期待2015
    Mysql 导出数据库和指定表中的数据
    Ajax跨域问题
  • 原文地址:https://www.cnblogs.com/chen-yong/p/5575177.html
Copyright © 2020-2023  润新知