nagios配置全攻略
通过整合pnp4nagios,ndoutils,nconf提供了关于nagios的一套完整的配置方案
操作系统Centos5.5,目前最新版本的nagios3.3.1,装上之后界面变化了太难看,所以这里我还用3.2.3的版本来安装
首先把编译环境准备好,我们这里把开发库先都装上
yum groupinstall "Development Libraries" "Development Tools" "Legacy Software Development" "X Software Development" -y
#########################################################################
naigos安装配置:
安装需要的软件包
yum install mysql perl mysql-server perl-DBI perl-DBD-MySQL httpd gcc glibc glibc-common gd gd-devel ruby ruby-devel2 ruby-devel mysql-devel
yum install php53-* yum默认安装的是5.1版本的php,但是pnp4nagios-0.6.6需要5.2以上版本的php,我们这里就装5.3的
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
useradd -m nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G apache nagios
tar zxf nagios-3.2.3.tar.gz
cd nagios-3.2.3
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
输入密码并记住,因为这个同时也是网页访问nagios时要输入的密码。
chkconfig --add nagios
chkconfig nagios on
chkconfig httpd on
chkconfig mysqld on
tar nagios-plugins-1.4.15.tar.gz
cd nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
service nagios start
service httpd start
service mysqld start
使用http://localhost/nagios/来访问
##########################################################################
pnp4nagios的安装和配置
接下来我们来配置pnp4nagios,能够把nagios捕获到的数据绘制成图片
rrdtool依赖众多,这里我选择下载rrdtool的rpm包
rrdtool-perl-1.4.4-1.el5.wrl.i386.rpm rrdtool-devel-1.4.4-1.el5.wrl.i386.rpm rrdtool-1.4.4-1.el5.wrl.i386.rpm
rpm -ivh rrdtool-*
tar -xvf pnp4nagios-0.6.6.tar.gz
cd pnp4nagios-0.6.6
./configure --with-nagios-user=nagios --with-nagios-group=nagcmd
make all
make install
make install-webconf
make install-config
make isntall-init
make fullinstall
pnp4nagios官方提供了三种配置方法,我这里选取一种
vi /usr/local/nagios/etc/nagios.cfg
process_performance_data=1
#
# service performance data
#
service_perfdata_file=/usr/local/pnp4nagios/var/service-perfdata
service_perfdata_file_template=DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=15
service_perfdata_file_processing_command=process-service-perfdata-file
#
# host performance data starting with Nagios 3.0
#
host_perfdata_file=/usr/local/pnp4nagios/var/host-perfdata
host_perfdata_file_template=DATATYPE::HOSTPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tHOSTPERFDATA::$HOSTPERFDATA$\tHOSTCHECKCOMMAND::$HOSTCHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$
host_perfdata_file_mode=a
host_perfdata_file_processing_interval=15
host_perfdata_file_processing_command=process-host-perfdata-file
vi /usr/local/nagios/etc/objects/commands.cfg 修改最后两行为
define command{
command_name pr
相关新闻>>
- 发表评论
-
- 最新评论 更多>>