Centos系统下载大全 | Redhat系统下载大全 | Windows2012系统下载大全 | Windows2008系统下载大全| CMS教程 | 网站地图 51运维网-专注Linux/Unix系统安全运维!
当前位置:51运维网 > 监控 > Nagios > 正文

CentOS下nagios和centreon安装过程

时间:2016-05-27 00:18 来源:网络整理 作者:51ou.com 阅读:

本文介绍完整的nagios和centreon安装过程。


安装环境:

CentOS5.6,X64 updated。

Monitor Engine:Nagios

Broker module:NDoutils

假设:

已安装并启动mysql

路径为:/usr/local/mysql/

sock路径:/var/lib/mysql/mysql.sock

步骤参考英文原文:


1、下载安装包

#下载nagios、nagios-plugin、nrpe、ndoutils以及ndoutils的一个patch

    cd/data/tool



#在 检查安装centreon所需要的软件包

#下载 centreon 2.4.0


wget ?id=4264

#安装一些必要的package


yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp

2、开始安装nagios
#建立用户和组


chattr -i /etc/passwd /etc/shadow /etc/group /etc/gshadow

useradd nagios

groupadd nagcmd

usermod -a -G nagcmd nagios

usermod -a -G nagcmd apache

#安装 nagios-core


tar-zxvf nagios-3.5.1.tar.gz

cdnagios

./configure--prefix=/usr/local/nagios--with-command-group=nagcmd \

--enable-event-broker --enable-embedded-perl --with-perlcache

makeall

makeinstall

makeinstall-init

makeinstall-config

makeinstall-commandmode

makeinstall-webconf

cp-R contrib/eventhandlers//usr/local/nagios/libexec/

chown-R nagios:nagios /usr/local/nagios/libexec/eventhandlers

#启动 nagios apache


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

/etc/init.d/nagiosstart

/etc/init.d/httpdstart

#创建nagios用户用于登录    


htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

#安装 nagios-plugins


tar -zxvf nagios-plugins-1.5.tar.gz

cd ../nagios-plugins-1.5

./configure --with-nagios-user=nagios \

--with-nagios-group=nagios \

--prefix=/usr/local/nagios \

--enable-redhat-pthread-workaround --with-ipv6=no \

--enable-perl-modules \

--with-mysql=/usr/local/mysql

make && make install

#安装nrpe


tar-zxvf nrpe-2.15.tar.gz

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

makeall

makeinstall-plugin

makeinstall-daemon

makeinstall-daemon-config

makeinstall-xinetd

  安装xinetd以便管理


yum install xinetd -y

sed -i 's/127.0.0.1/127.0.0.1 183.61.70.34/'/etc/xinetd.d/nrpe

sed -i '578 i\nrpe            5666/tcp                        # NRPE'/etc/services

service xinetd restart


/usr/local/nagios/libexec/check_nrpe -H localhost -c check_users

sed -i 's/allowed_hosts=127.0.0.1/allowed_hosts=127.0.0.1,<your ip addr>/'/usr/local/nagios/etc/nrpe.cfg

3、安装 ndoutils


tar-zxvf ndoutils-1.5.2.tar.gz

cdndoutils-1.5.2

patch -p1 -N < ../ndoutils1.5.2_light.patch

./configure--prefix=/usr/local/nagios/--enable-mysql --with-mysql=/usr/local/mysql--with-ndo2db-user=nagios --with-ndo2db-group=nagios

      默认的源文件 make 会报错 修改如下


sed-i -e 's/#include <mysql\/mysql.h>/#include <\/usr\/local\/mysql\/include\/mysql.h>/'include/config.h

sed-i -e 's/#include <mysql\/errmsg.h>/#include <\/usr\/local\/mysql\/include\/errmsg.h>/'include/config.h

make

makeinstall


cp./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg

cp./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg

      #编辑/usr/local/nagios/etc/nagios.cfg 在broker_module处添加


broker_module=/usr/local/nagios/bin/ndomod-3x.o config_file=/usr/local/nagios/etc/ndomod.cfg

  #安装启动文件


chmod+x daemon-init

cpdaemon-init /etc/init.d/ndo2db

    #创建数据库用户  


mysql -p

>>createdatabasenagios;

GRANTALLPRIVILEGESONnagios.* TO'nagios'@'localhost'IDENTIFIED BY'nagios';

>>FLUSH PRIVILEGES;

    #安装数据库


cddb/

./installdb-u nagios -p nagios -h localhost -d nagios

4、安装 centreon


usermod-a -G apache centreon

usermod-a -G nagios centreon

wget

wget

rpm --importRPM-GPG-KEY.dag.txt

rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

yum clean all

yum update

yum upgrade

yum installhttpd gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD \

openssl-devel perl-DBD-MySQL mysql-server mysql-devel php php-mysql php-gd php-ldap php-xml php-mbstring \

perl-Config-IniFiles perl-DBI perl-DBD-MySQL rrdtool perl-rrdtool perl-Crypt-DES perl-Digest-SHA1 \

perl-Digest-HMAC net-snmp-utils perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp \

dmidecode lm_sensors perl-Net-SNMP net-snmp-perl fping cpp gcc gcc-c++ libstdc++ glib2-devel \

php-pear


usermod-U apache

pear channel-update pear.php.net

peardev upgrade-all

pear upgrade-all

      报错处理:[PHP Fatal error:  Allowed memory size of 8388608 bytes exhausted]


echo'memory_limit = 256M'>>/etc/php.ini

  #开始安装centreon


./install.sh -i

  #经过一系列回车(保持默认配置)以及需要填写的路径完成命令行下的centreon安装。

  #此处不一一贴出

  #需要注意的两个路径RRDs.pm、PEAR.php 可使用find 找到准确路径


/usr/local/rrdtool/lib/perl/5.8.8/x86_64-linux-thread-multi/RRDs.pm

/usr/share/pear/PEAR.php

  #配置centreon数据库用户


GRANTALLPRIVILEGESON`centreon`.* TO'centreon'@'localhost'identified by'centreon';

GRANTALLPRIVILEGESON`centreon_storage`.* TO'centreon'@'localhost'identified by'centreon';

GRANTALLPRIVILEGESON`centreon_status`.* TO'centreon'@'localhost'identified by'centreon';

FLUSH PRIVILEGES;

感谢您对【51运维网 http://www.51ou.com/】的支持,我们为您免费提供《CentOS下nagios和centreon安装过程》技术文章,《CentOS下nagios和centreon安装过程》详细使用和说明,有时《CentOS下nagios和centreon安装过程》可能不完善、敬请谅解!如果《CentOS下nagios和centreon安装过程》有错误请给我们留言,我们将尽快修复文章错误,如果您觉得本站不错,请分享给周围的朋友!谢谢!

顶一下
(0)
0%
踩一下
(0)
0%
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
验证码:点击我更换图片