centreon+nagios安装测试(一…

原文地址:centreon+nagios安装测试(一)-环境搭建 作者:改变自己

[简介]

    centreon是开源的IT监控软件,由法国人于2003年开发,最初名为Oreon,并于2005年正式更名为centreon

  centreon作为nagios的分布式监控管理平台,其功能之强大,打造了centreonIT监控方面强势地位,它的底层使用nagios监控软件,nagios通过ndoutil模块将监控数据写入数据库,centreon读取该数据并即时的展现监控信息,通过centreon可以简单地管理和配置所有nagios,因此,完全可以使用centreon轻易的搭建企业级分布式IT基础运维监控系统。

  在功能方面,将它与nagios+cacti方式对比,说一下优点:

  1gui方式添加host,支持hosttemplateservicestemplate,自动建立关联服务,与nagios+cacti相比配置方便简单。

  2、支持graphtemplate,添加servcie时自动添加graph,不必象nagios+cacti监控与流量图设置2步走。

  3host监控可以全部采用nrpe方式,不必象nagios+cacti生成流量图必须使用snmp

  4、支持多节点分布式监控,nagios+cacti的分布式监控现在想起来都头痛。

  5、支持acl权限管理方式,对用户权限限制到菜单项,nagios+cacti一个帐号大家用过时啦。

  6、详细的日志管理功能,日志搜索过滤都支持 7、功能模块化管理,想要新功能官方没有怎么办,自己写去。

 

系统:centos-5.6 32

server192.168.128.21

client192.168.128.22

 

以下安装过程参考了一位同事及网络上的一些文档~

一、安装centreon所需环境

可参考官网:

http://documentation.centreon.com/01-centreon/centreon_web/documentation/01-setup/installation_from_sources/step_01_-_prerequisites/centos

1)安装yum

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm

wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

rpm --import RPM-GPG-KEY.dag.txt

rpm -Uvh rpmforge-release-0.5.1-1.el5.rf.i386.rpm

 

2)yum升级系统软件:

yum update

yum upgrade

 

3)、安装Apache2

yum install httpd

usermod -U apache

 

4)、安装GD

yum install gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD

 

5)、安装mysql

yum install openssl-devel perl-DBD-MySQL mysql-server mysql-devel

 

6)、安装PHP及扩展

yum install php php-mysql php-gd php-ldap php-xml php-mbstring

 

7)、安装PERL及扩展模块

yum install perl-Config-IniFiles perl-DBI perl-DBD-MySQL

 

8)、安装RRDTools

yum install rrdtool perl-rrdtool

 

9)、安装SNMP

yum install perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils

yum install perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs

yum install php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl

 

10)、安装其他所需库

yum install fping cpp gcc gcc-c++ libstdc++ glib2-devel

 

11)、安装PEAR

yum install php-pear

pear channel-update pear.php.net

pear upgrade-all

 

二、server端服务安装

1)、安装nagios

[root@centreon ~]#useradd nagios

[root@centreon ~]#groupadd nagcmd

[root@centreon ~]#usermod -G nagios,nagcmd nagios

[root@centreon ~]#cd /usr/local/src/

[root@centreon src]#tar zxf nagios-3.4.1.tar.gz

[root@centreon src]#cd nagios

[root@centreon nagios]# ./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker --enable-embedded-perl

[root@centreon nagios]#make all

[root@centreon nagios]#make install

[root@centreon nagios]#make install-init

[root@centreon nagios]#make install-commandmode

[root@centreon nagios]#make install-config

[root@centreon nagios]#make install-webconf

[root@centreon nagios]#cd ../

 

2)、安装nagios-plugins

[root@centreon src]#tar zxf nagios-plugins-1.4.16.tar.gz

[root@centreon src]#cd nagios-plugins-1.4.16

[root@centreon nagios-plugins-1.4.16]#./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules

[root@centreon nagios-plugins-1.4.16]#make

[root@centreon nagios-plugins-1.4.16]#make install

[root@centreon nagios-plugins-1.4.16]#cd ../

 

3)、安装nrpe

[root@centreon src]#tar zxf nrpe-2.13.tar.gz

[root@centreon src]#cd nrpe-2.13

[root@centreon nrpe-2.13]#./configure

[root@centreon nrpe-2.13]#make all

[root@centreon nrpe-2.13]#make install-plugin

[root@centreon nrpe-2.13]#make install-daemon

[root@centreon nrpe-2.13]#make install-daemon-config

[root@centreon nrpe-2.13]#cd ../

 

4)、安装ndoutils

[root@centreon src]# tar zxf ndoutils-1.5.2.tar.gz

[root@centreon src]# cd ndoutils-1.5.2

[root@centreon ndoutils-1.5.2]# ./configure --prefix=/usr/local/nagios/ --enable-mysql --with-ndo2db-user=nagios --with-ndo2db-group=nagios

[root@centreon ndoutils-1.5.2]# make

[root@centreon ndoutils-1.5.2]# make install

[root@centreon ndoutils-1.5.2]# cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg

[root@centreon ndoutils-1.5.2]# cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg

[root@centreon ndoutils-1.5.2]# cp daemon-init /etc/init.d/ndo2db

[root@centreon ndoutils-1.5.2]# vi /etc/init.d/ndo2db

killproc_ndo2db ()

{

        kill `pidof ndo2db |cut -f1 -d " "` >/dev/null 2>&1         //重复两行

        kill `pidof ndo2db |cut -f1 -d " "` >/dev/null 2>&1

}

 

stop)

 

        echo  "Stopping $servicename..."

        killproc_ndo2db

                ;;

[root@centreon ndoutils-1.5.2]# chmod +x /etc/init.d/ndo2db

[root@centreon ndoutils-1.5.2]# chkconfig --add ndo2db

[root@centreon ndoutils-1.5.2]# chkconfig --level 345 ndo2db on

[root@centreon ndoutils-1.5.2]# cd ../

 

5)、安装centreon

[root@centreon src]# tar zxf centreon-2.3.8.tar.gz

[root@centreon src]# cd centreon-2.3.8

[root@centreon centreon-2.3.8]# ./install.sh –i

以下是安装过程全部截图:

[转载]centreon+nagios安装测试(一)-环境搭建
GPL许可证,填写y

确定安装centreon几部分模块,全部填写y


[转载]centreon+nagios安装测试(一)-环境搭建
Centreon etc directory更改为/usr/local/centreon/etc

Centreon variable library directory更改为/usr/local/centreon/var/lib


[转载]centreon+nagios安装测试(一)-环境搭建
RRD perl module installed [RRDs.pm]更改为/usr/lib/perl5/vendor_perl/5.8.8/RRDp.pm

(可以通过 rpm -ql perl-rrdtool 确认,最好验证,不一定是上面的路径)

PEAR [PEAR.php]更改为/usr/share/pear/PEAR.php

(可以通过 rpm -ql php-pear 确认)


[转载]centreon+nagios安装测试(一)-环境搭建
NDO ndomod binary更改为/usr/local/nagios/bin/ndomod.o


[转载]centreon+nagios安装测试(一)-环境搭建
配置sudo


[转载]centreon+nagios安装测试(一)-环境搭建
配置apache


[转载]centreon+nagios安装测试(一)-环境搭建
更新pear模块


[转载]centreon+nagios安装测试(一)-环境搭建
所有模块更新OK


[转载]centreon+nagios安装测试(一)-环境搭建
Centreon Run Dir directory更改为/usr/local/centreon/var/run

CentStorage RRD directory更改为/usr/local/centreon/var/lib


[转载]centreon+nagios安装测试(一)-环境搭建
继续centstorage安装


[转载]centreon+nagios安装测试(一)-环境搭建
centcore安装


[转载]centreon+nagios安装测试(一)-环境搭建
CentPlugins lib directory更改为/usr/local/centreon/var/lib/centplugins


[转载]centreon+nagios安装测试(一)-环境搭建
centplugin traps安装,安装完成。

 

6)、启动相关服务

[root@centreon centreon-2.3.8]# cd

[root@centreon ~]# /etc/init.d/httpd start

[root@centreon ~]# /etc/init.d/mysqld start

[root@centreon ~]# mysqladmin -u root password '111111'

[root@centreon ~]# /etc/init.d/ndo2db start

 

7)WEB界面安装

浏览器输入:http://192.168.128.21/centreon

[转载]centreon+nagios安装测试(一)-环境搭建
点击start


[转载]centreon+nagios安装测试(一)-环境搭建
选择I accpet,点击Next


[转载]centreon+nagios安装测试(一)-环境搭建
默认环境配置


[转载]centreon+nagios安装测试(一)-环境搭建
检验PHP配置


[转载]centreon+nagios安装测试(一)-环境搭建
检验PHP配置


[转载]centreon+nagios安装测试(一)-环境搭建
Mysql root密码:填入上面初始化密码,centon三个库及密码:自定义


[转载]centreon+nagios安装测试(一)-环境搭建
Mysql检查


[转载]centreon+nagios安装测试(一)-环境搭建
配置centon管理员用户、密码,其他三项自定义


[转载]centreon+nagios安装测试(一)-环境搭建
是否使用LADP密码认证,默认No


[转载]centreon+nagios安装测试(一)-环境搭建
centreon配置检查


[转载]centreon+nagios安装测试(一)-环境搭建
Centreon数据库检查


[转载]centreon+nagios安装测试(一)-环境搭建
点击Click here to complete your install完成安装


[转载]centreon+nagios安装测试(一)-环境搭建
登陆首页界面


[转载]centreon+nagios安装测试(一)-环境搭建
登陆后界面


[转载]centreon+nagios安装测试(一)-环境搭建
检查nagios.cfg的配置,configuration -> nagios -> nagios.cfg -> Nagios CFG 1

点击Data标签,检查NDO的配置,主要有以下2

Broker Module         /usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg

Broker Module Options   -1


[转载]centreon+nagios安装测试(一)-环境搭建
检查ndo2db.cfg的配置,configuration -> centreon -> ndo2db.cfg -> Principal

点击General标签,检查NDO的配置,主要有以下3

Socket Type      tcp

Socket Name   /var/run/ndo.sock

TCP Port  5668


[转载]centreon+nagios安装测试(一)-环境搭建
检查ndomod.cfg的配置,configuration -> centreon -> ndomod.cfg -> Central-mod

检查NDO的配置,主要有以下3

Interface Type tcpsocket

Output     127.0.0.1

TCP Port  5668


[转载]centreon+nagios安装测试(一)-环境搭建
nagios配置生成检查,configuration -> nagios -> Generate -> Export


[转载]centreon+nagios安装测试(一)-环境搭建
配置检查正确后,将Actions项其他三个勾选上生成配置。
 

8)、启动相关服务

[root@centreon ~]# /etc/init.d/nagios start

[root@centreon ~]# /etc/init.d/ndo2db restart

[root@centreon ~]# /etc/init.d/centcore start

[root@centreon ~]# /etc/init.d/centstorage start

[root@centreon ~]#/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg –d

 

9)centreon汉化

[root@centreon ~]#wget http://cacti-nagios.googlecode.com/files/messages.mo

[root@centreon ~]#mkdir -p /usr/local/centreon/www/locale/zh_CN/LC_MESSAGES/

[root@centreon ~]#cp messages.mo /usr/local/centreon/www/locale/zh_CN/LC_MESSAGES/

[root@centreon ~]#chown apache:apache -R /usr/local/centreon/www/locale

[转载]centreon+nagios安装测试(一)-环境搭建
Administration -> admin -> Language选择zh_CN,设置完成后重新登陆

 

[转载]centreon+nagios安装测试(一)-环境搭建

三、client端服务安装(server端完全一样,只是需要修改nrpe的配置)

1)、安装nagios-plugins

[root@client ~]#cd /usr/local/src/

[root@client src]#useradd -M -s /sbin/nologin nagios

[root@client src]#tar zxf nagios-plugins-1.4.16.tar.gz

[root@client src]#cd nagios-plugins-1.4.16

[root@client nagios-plugins-1.4.16]#./configure --with-nagios-user=nagios --with-nagios-

 

group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules

[root@client nagios-plugins-1.4.16]#make

[root@client nagios-plugins-1.4.16]#make install

[root@client nagios-plugins-1.4.16]#cd ../

 

2)、安装nrpe

[root@client src]#tar zxf nrpe-2.13.tar.gz

[root@client src]#cd nrpe-2.13

[root@client nrpe-2.13]#./configure

[root@client nrpe-2.13]#make all

[root@client nrpe-2.13]#make install-plugin

[root@client nrpe-2.13]#make install-daemon

[root@client nrpe-2.13]#make install-daemon-config

[root@client nrpe-2.13]# vi /usr/local/nagios/etc/nrpe.cfg

allowed_hosts=127.0.0.1

修改为nagios serverIP

allowed_hosts=192.168.128.21

[root@client nrpe-2.13]# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg –d

 

接下来就可以通过centreon强大的web界面来配置监控项,下次再说~~~

你可能感兴趣的:(系统监控)