nagios安装,网上太多了,这个是自己安装后的手记。

nagios安装

下载:wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz
安装:
tar -zxvf nagios-3.2.0.tar.gz
cd nagios-3.2.0
./configure –prefix=/usr/local/nagios –with-command-group=nagcmd
make all
make all完毕后有如下提示:
“If the main program and CGIs compiled without any errors, you
can continue with installing Nagios as follows (type ‘make’
without any arguments for a list of all possible options):

  make install
     – This installs the main program, CGIs, and HTML files

  make install-init
     – This installs the init script in /etc/rc.d/init.d

  make install-commandmode
     – This installs and configures permissions on the
       directory for holding the external command file

  make install-config
     – This installs *SAMPLE* config files in /usr/local/nagios/etc
       You’ll have to modify these sample files before you can
       use Nagios.  Read the HTML documentation for more info
       on doing this.  Pay particular attention to the docs on
       object configuration files, as they determine what/how
       things get monitored!

  make install-webconf
     – This installs the Apache config file for the Nagios
       web interface”
依次运行如下命令:
make install
make install-init
make install-commandmode
make install-config
make install-webconf
给nginx添加认证:
修改nginx的配置文件如下:
    location /nagios/ {
    alias /usr/local/nagios/share/;
    index index.html index.htm index.php;
    auth_basic “nagios”;
    auth_basic_user_file /usr/local/nagios/etc/htpasswd admin
    }
生成htpasswd文件:
/usr/bin/htpasswd -c /usr/local/nagios/etc/htpasswd admin
其中htpasswd是apache提供的工具
配置nagios
nagios web界面提示
It appears as though you do not have permission to view information for any of the services you requested…
打开cgi.cfg配置文件,里面有个参数:
use_authentication=1
为了保障系统的安全性,nagios设置了这个参数,默认为1,改为0即可

 

配置:
下载插件:
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.13.tar.gz
tar -zxvf nagios-plugins-1.4.13.tar.gz
cd nagios-plugins-1.4.13
./configure –prefix=/usr/local/nagios
make
make install
配置附件:
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nrpe-2.12.tar.gz
tar -zxvf nrpe-2.12.tar.gz
cd nrpe-2.12
./configure –prefix=/usr/local/nagios
make all
make install-plugin
make install-daemon
make install-daemon-config
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
返回:[root@localhost nrpe-2.12]# /usr/local/nagios/libexec/check_nrpe -H localhost
      NRPE v2.12
完成。
配置perl,cgi,nginx

发表回复

您的电子邮箱地址不会被公开。