以 nagios 的监控引擎。安装环境。

centreon 是一个自动化监控平台,监控数据存储于 mysql
中,监控配置于UI中操作,方便且功能强大。

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

图片 1


 

设置环境:

  1. centreon 监控引擎

CentOS5.6,X64
updated。

centreon 可以跟 nagios 结合,使用 nagios 的监察引擎,也可行使 centreon
自己之监控引擎。

Monitor
Engine:Nagios

依据 centreon 的测试,采用centreon 引擎比 nagios
引擎快8到9倍增。因此,最新的 centreon 3.2 发行版默认下 centreon 引擎。

Broker
module:NDoutils

 

假设:

  1. 装方式

现已安装并启动mysql

2.1 概述

路径为:/usr/local/mysql/

查看搜索引擎,过去犹利用 Nagios + NDOUtils + centreon 软件包 +
众多依靠包的装置方式,不仅安装过程繁琐、而且nagios/ndoutils性能不佳。

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

现今centreon 官方网站提供了 iso 镜像文件,默认使用Centreon
Engine/Centreon Broker 替代
Nagios/NDOUtils,集成了所有的倚重软件,不仅安装好,而且性能好。

步骤参考英文原文:http://documentation.centreon.com/docs/centreon/en/latest/installation/from\_sources.html

iso 文件下充斥地址:


https://download.centreon.com/

1、下载安装包

 

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

2.2 安装过程

cd /data/tool

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.5.1.tar.gz
wget --no-check-certificate https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
wget http://jaist.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz
wget http://nchc.dl.sourceforge.net/project/nagios/ndoutils-1.x/ndoutils-1.5.2/ndoutils-1.5.2.tar.gz
wget http://svn.centreon.com/trunk/ndoutils-patch/ndoutils1.5.2_light.patch

为此 iso
文件启动虚拟机或者刻盘后启动服务器,按照向导,基本上点击默认设置就可知打响安装,安装好后在浏览器被做客
http://YOUR\_IP/centreon 进行简短的部署。

#在
http://www.centreon.com/Content-Products-IT-network-monitoring/supported-software-and-requirements
检查装置centreon所待之软件包
#下载
centreon 2.4.0

翔过程可以参见 centreon 的文档:

wget http://download.centreon.com/index.php?id=4264

https://documentation.centreon.com/docs/centreon/en/latest/installation/01a.html

#设置有少不了的package

 

yum install -y wget httpd php gcc glibc glibc-common gd gd-devel make net-snmp
  1. 启动监控

初使用 centreon 请按照下述方法启用监控,默认已经发出了一个 localhost
的监督配置了。如果未这么操作,已经放好的 host 和 service
的督查信息发生或看不到的:

2、开始安装nagios
#确立用户以及组

Start monitoring

To start monitoring engine :

  1. On web interface, go to Configuration ==> Monitoring
    engines
  2. Leave the default options and click on Export
  3. Uncheck Generate Configuration Files and Run monitoring
    engine debug (-v)
  4. Check Move Export Files and Restart Monitoring Engine
  5. Click on Export again
  6. Log into the ‘root’ user on your server
  7. Start Centreon Broker
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
cd nagios
./configure --prefix=/usr/local/nagios --with-command-group=nagcmd \
--enable-event-broker --enable-embedded-perl --with-perlcache
make all
make install
make install-init
make install-config
make install-commandmode
make install-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/nagios start
/etc/init.d/httpd start

#创办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
make all
make install-plugin
make install-daemon
make install-daemon-config
make install-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
cd ndoutils-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
make install

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
cp daemon-init /etc/init.d/ndo2db

     #始建数据库用户
 

mysql -p
>>create database nagios;
GRANT ALL PRIVILEGES ON nagios.* TO 'nagios'@'localhost' IDENTIFIED BY 'nagios';
>>FLUSH PRIVILEGES;

     #安装数据库

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

4、安装
centreon

usermod -a -G apache centreon
usermod -a -G nagios centreon
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm --import RPM-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 install httpd 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数据库用户

GRANT ALL PRIVILEGES ON `centreon`.* TO 'centreon'@'localhost' identified by 'centreon';
GRANT ALL PRIVILEGES ON `centreon_storage`.* TO 'centreon'@'localhost' identified by 'centreon';
GRANT ALL PRIVILEGES ON `centreon_status`.* TO 'centreon'@'localhost' identified by 'centreon';
FLUSH PRIVILEGES;

   #签到web界面进行下同样步安装:

http://SERVER\_ADDRESS/centreon

   #检查php拓展

图片 2

   #配置Nagios相关路线

图片 3

   #配置NDoutils路径

图片 4

   #管理员账户密码

图片 5

   #数据库连接信息

图片 6

   #开班安装数据库

图片 7

   #装好而登录

图片 8

   以上也centreon安装完整步骤,坑稍微小多。

   特别是centreon命令行模式安装时每个路径、文件称都休想写错。

本文出自 “Linux狂想曲”
博客,请务必保留这个出处http://mrcto.blog.51cto.com/1923168/1344091

http://www.bkjia.com/windows/617805.htmlwww.bkjia.comtruehttp://www.bkjia.com/windows/617805.htmlTechArticle本文介绍完整的nagios和centreon安装过程。
安装环境: CentOS5.6,X64 updated。 Monitor Engine:Nagios Broker
module:NDoutils 假设: 已设置并启动mysql 路径…

相关文章