CentOS安装配置nagios(1)-成都快上网建站

CentOS安装配置nagios(1)

一,事前准备

10年建站经验, 成都网站制作、成都网站建设客户的见证与正确选择。成都创新互联公司提供完善的营销型网页建站明细报价表。后期开发更加便捷高效,我们致力于追求更美、更快、更规范。

   安装nagios前需要解决用户,依赖包之类的问题。正所谓三军未动粮草先行。

    1.yum -y installgcc automake autoconf libtool make gd zilb

         安装   gcc等必要工具

         2. 建立nagios专用的用户和组。  useradd nagios

        3. 源码安装apache

           httpd-2.2.3/

            ./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite

           make && make install

      4.源码安装PHP  

         cd ../php-5.2.2

          ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/lib --with-gd --with-zlib --enable-track-vars --with-xml

   make && make install

 5. 将apache运行用户加入nagios组(让apache对nagios有写权限,启动web修改功能)

二。开始正式安装主程序

     tar zxvf nagios-3.2.3.tar.gz

cd nagios-3.2.3

         ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios

     make all

     make install

执行完这个步骤后,程序会提示依次运行make install-init ,make install-commandmode,make install-config 这几个命令。

           make install-init

          make install-commandmode

           make install-config

       make install-webconf

          接下来安装插件nagios-plugins-1.4.15.tar.gz 主要为nagios提供各种脚本来监控主机。

                       tar zxvf  nagios-plugins-1.4.15.tar.gz

                      cdnagios-plugins-1.4.15

./configure --prefix=/usr/local/nagios  --with-nagios-user=nagios --with-nagios-group=nagios

                        make && make install

               添加网页访问的管理员账号

/usr/local/apache/htpasswd -c /usr/local/nagios/etc/htpasswd nagiosadmin

             这里会设置密码,要记住。

三。 APACHE的配置修改

     打开APACHE的配置文件 /etc/httpd/conf/httpd.conf (yum安装的httpd路径,如果为源代码安装 则是源代码安装的路径)

   在末尾添加如下信息

#setting for nagios

ScriptAlias /nagios/cgi-bin /usr/local/nagios/sbin

   Options ExecCGI

   AllowOverride None

   Order allow,deny

   Allow from all

   AuthName "Nagios Access"

   AuthType Basic

AuthUserFile /usr/local/nagios/etc/htpasswd  //这里路径会根据nagios版本不同有所差异

   Require valid-user

Alias /nagios /usr/local/nagios/share

   Options None

   AllowOverride None

   Order allow,deny

   Allow from all

   AuthName "Nagios Access"

   AuthType Basic

AuthUserFile /usr/local/nagios/etc/htpasswd  //这里路径会根据nagios版本不同有所差异

   Require valid-user


如果你的httpd是初次安装,则还需要修改以下几项

ServerName 127.0.0.1:80

DirectoryIndex index.html index.php

AddType application/x-httpd-php .php .phtml
AddType applicatoin/x-httpd-php-source .phps

四。启动nagios前的最后准备

1.

检查配置文件是否正确

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

2.开启服务

service httpd start

chkconfig --add  nagios

chkconfig nagios on

service nagios   start

3.关闭防火墙

services iptables stop

4.这样就能登录上去了。但是如果还不能看,可能是因为开启了SElinux

输入如下命令

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/

这样一个监控端的nagios就起来了

但是他还没有进行任何配置,所以还无法监控其他主机。

具体配置我下期再写吧- -


文章题目:CentOS安装配置nagios(1)
文章转载:http://kswjz.com/article/jepshi.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流