Chinaunix首页 | 论坛 | 博客
  • 博客访问: 78840
  • 博文数量: 28
  • 博客积分: 579
  • 博客等级: 中士
  • 技术积分: 245
  • 用 户 组: 普通用户
  • 注册时间: 2011-09-30 18:17
文章分类

全部博文(28)

文章存档

2012年(1)

2011年(27)

我的朋友

分类: 系统运维

2011-12-05 11:40:23

我的安装步骤


1
所需软件

被监控端需要安装   nagios-pluginsnrpe
httpd-2.2.21.tar  

 

php-5.3.8.tar    


nagios-3.2.3.tar  

 

nrpe-2.12.tar.gz  

 

nagios-plugins-1.4.15.tar.gz



2
nagios安装

#tar zxvf nagios-3.2.3.tar

#cd  nagios-3.23

#./configure

–prefix=/usr/local/nagios
#make all
#make install all      

2.2
nagios-plugins的安装
#tar –xvzf nagios-plugins-1.4.15.tar
#cd nagios-plugins-1.4.15
#./configure --prefix=/usr/local/nagios

#make all
#make install all
安装完成以后在/usr/local/nagios-plugins会产生一个libexec的目录,将该目录全部移动到/usr/local/nagios目录下


3
Nrpe安装

#tar –zxvf nrpe-2.12.tar.gz

#cd nrpe-2.12

#./configure

--prefix=/usr/local/nagios

#Make all

#Make install al

 

启动nrpe,端口为5666
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg –d

 

4appache安装

#Tar –zxvf httpd-2.2.21.tar

#Cd httpd-2.2.21

#./configure

--prefix=/usr/local/apache2

#Make all

#Make install all

 

/etc/rc.conf上加上

apache_enable=”yes”

accf_data_load="YES"

accf_http_load="YES"

apache22_http_accept_enable="YES"

 

5php的安装:

#tar –zxvf php-5.3.8.tar

#cd php-5.3.8

#./configure

--prefix=/usr/local/php_5.2.17

--with-apxs2=/usr/local/apache2/bin/apxs

 --with-mysql=/usr/var/db/mysql      # 有安装mysql可以加上

 -with-config-file-path=/usr/local/bin

#make all

#make install all

 

4Nagios的设定:
a
配置apache

DirectoryIndex index.html index.php
LoadModule php5_module        modules/libphp5.so 
加载PHP模块

ServerAdmin localhost

ServerName localhost:80localhost可以改成你的网站主页地址,端口自然也可以改)

AddType application/x-httpd-php .php  加上这句将php后缀的给php解析

 

###nagios

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

 

#  SSLRequireSSL

    Options ExecCGI

    AllowOverride None

    Order allow,deny

    Allow from all

#  Order deny,allow

#  Deny from all

#  Allow from 127.0.0.1

    AuthName "Nagios Access"

    AuthType Basic

    AuthUserFile /usr/local/nagios/etc/htpasswd

    Require valid-user

 

Alias /nagios "/usr/local/nagios/share"

 

#  SSLRequireSSL

    Options None

    AllowOverride None

    Order allow,deny

    Allow from all

#  Order deny,allow

#    Deny from all

#  Allow from 127.0.0.1

    AuthName "Nagios Access"

    AuthType Basic

    AuthUserFile /usr/local/nagios/etc/htpasswd

    Require valid-user

 

配置完成后先尝试能不能解析html确保apache能够正常工作后在尝试解析php


b
、设置访问权限
/usr/local/nagios/share目录下
[]#/usr/local/apache/bin/htpasswd –c /usr/local/nagios/etc/htpasswd nagios
这个apache目录根据安装目录的不同而不同,主要所以用.htpasswd这个命令生成用户名和密码

 

c、设置nagios

修改cgi.cfg  use_authentication=1use_authentication=0,即不用验证.不然有一些页面不会显示。
建立所有的cfg文件

然后检查配置文件是否出错
/usr/local/nagios/bin/nagios –v /usr/local/nagios/etc/nagios.cfg
出现Total Warnings: 0
  Total Errors:  0
为正常
出错的话,就是.cfg文件有问题 根据错误提示 一个个修正


3.5
、启动后台进程  
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
/usr/local/etc/rc.d/nagios start   #
如果启动没反应,而且想重启的话就先kill

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

 

/usr/local/apache2/bin/apachectl -k start

看是否有错误再一个一个修正


(
如果有些页面看不到的话.可以在cgi.cfg文件中
把带有authorized的选项前的#号去掉即可)
这些配置完以后,基本的nagios配置完成

 

开机启动nagios

/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d

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


               
               
               

阅读(1018) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:nagios 深入配置 各种服务监控

给主人留下些什么吧!~~