nagios安装部署

  1. nagios服务端安装

    基础套件  rpm -q gcc glibc glibc-common gd gd-devel xinetd openssl-devel

    创建用户 

    useradd -r nagios

    mkdir /usr/local/nagios

    chown -R nagios.nagios /usr/local/nagios

    安装nagios  

    ./configure --prefix=/usr/local/nagios

    make all

    make install

    make install-init

    make install-commandmode

    make install-config

    添加nagios服务

    chkconfig --add nagios

    chkconfig --level 35 nagios

    安装nagios-plugins 

    ./configure --prefix=/usr/local/nagios

    make && make install


  2. http和php安装

    apache用的是httpd-2.4.10.tar.gz

    还需要apr-1.5.1.tar.gz和apr-util-1.5.4.tar.gz

    tar xf httpd-2.2.23.tar.gz

    tar xf apr-1.5.1.tar.gz

    tar xf apr-util-1.5.4.tar.gz

    cp -r /home/apr-1.5.1 srclib/apr

    cp -r apr-util-1.5.4 httpd-2.4.10/srclib/apr-util

    cd httpd-2.2.23

    ./configure --prefix=/usr/local/httpd --with-included-apr

    make && make install

    php安装

    ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs

    httpd.conf配置修改

    添加AddType application/x-httpd-php .php

    安装完成修改httpd.conf

    DirectoryIndex index.html 改成 DirectoryIndex index.php index.html



    开启cgi模块 LoadModule cgid_module modules/mod_cgid.so

                AddHandler cgi-script .cgi

    末尾添加

    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

    保存退出

    创建apache目录验证文件

    /usr/local/apache2/bin/htpasswd -c /usr/local/nagios/etc/htpasswd admin

    访问http://localhost/nagios 即可看到nagios的web界面





    

本文出自 “第一遍” 博客,转载请与作者联系!

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。