新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

CentOS安装配置nagios(1)-创新互联

一,事前准备

十多年的屏南网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。营销型网站建设的优势是能够根据用户设备显示端的尺寸不同,自动调整屏南建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联公司从事“屏南网站设计”,“屏南网站推广”以来,每个客户项目都认真落实执行。

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

  1.yum -y install gcc 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

           cd nagios-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就起来了

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

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

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


本文名称:CentOS安装配置nagios(1)-创新互联
URL网址:http://www.wjwzjz.com/article/dsghge.html
在线咨询
服务热线
服务热线:028-86922220
TOP