当前位置: 首页 > 工具软件 > Centreon > 使用案例 >

Centreon+nagios安装

太叔涵亮
2023-12-01
一、安装centreon所需环境
1)安装GD库
yum install gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD
2)安装Apache2
yum install httpd
usermod -U apache
3)安装mysql
yum install openssl-devel perl-DBD-MySQL mysql-server mysql-devel
4)安装PHP及扩展
yum install php php-mysql php-gd php-ldap php-xml php-mbstring
5)安装PERL及扩展模块
yum install perl-Config-IniFiles perl-DBI perl-DBD-MySQL
6)安装RRDTools
yum install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel  pam-devel 
yum install -y rrdtool perl-rrdtool rrdtool-devel
7)安装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
8)安装其他所需库
yum install fping cpp gcc gcc-c++ libstdc++ glib2-devel
9)安装PEAR
yum install php-pear
pear channel-update pear.php.net
pear upgrade-all


10)全量安装
yum -y install vixie-cron libjpeg* libpng* freetype* xml-commons* openssl* curl* libxml2-devel.x86_64 e2fsprogs* krb5-devel* krb5-libs* libr* libidn-devel gcc* mod_dav_svn pcre-devel bzip2* zlib* net-snmp* perl-devel
yum -y install httpd httpd-devel mysql-* php-* php-pear*




















安装yum源
scp root@172.26.159.180:/root/xzy/rpmforge-release-0.5.2-1.el6.rf.x86_64.rpm /usr/local/src
scp root@172.26.159.180:/root/xzy/RPM-GPG-KEY.dag.txt /usr/local/src
rpm --import /usr/local/src/RPM-GPG-KEY.dag.txt
rpm -Uvh /usr/local/src/rpmforge-release-0.5.2-1.el6.rf.x86_64.rpm


yum升级系统软件
yum update
yum upgrade




service sshd restart
二、server端服务安装
1)、安装nagios
useradd nagios
groupadd nagcmd
usermod -G nagios,nagcmd nagios
scp root@172.26.159.180:/root/xzy/nagios-3.4.1.tar.gz /usr/local/src/nagios-3.4.1.tar.gz
tar zxf nagios-3.4.1.tar.gz
cd nagios
./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker 
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
cd ../


2)、安装nagios-plugins
scp root@172.26.159.180:/root/xzy/nagios-plugins-1.4.16.tar.gz /usr/local/src/nagios-plugins-1.4.16.tar.gz
tar zxf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules
make
make install
cd ../


3)、安装nrpe
scp root@172.26.159.180:/root/xzy/nrpe-2.13.tar.gz /usr/local/src/nrpe-2.13.tar.gz
tar zxf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure --with-nrpe-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios --with-nagios-group=nagios --enable-command-args --enable-ssl
make all
make install-plugin
make install-daemon
make install-daemon-config
cd ../
验证NRPE安装
/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20




4)、安装ndoutils
scp root@172.26.159.180:/root/xzy/ndoutils-1.5.2.tar.gz /usr/local/src/ndoutils-1.5.2.tar.gz
tar zxf ndoutils-1.5.2.tar.gz
cd ndoutils-1.5.2
./configure --prefix=/usr/local/nagios
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
cp daemon-init /etc/init.d/ndo2db
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
        
保存文件后,继续执行命令
chmod +x /etc/init.d/ndo2db
chkconfig --add ndo2db
chkconfig --level 345 ndo2db on
cd ../


5)、安装centreon
scp root@172.26.159.180:/root/xzy/centreon-2.4.4.tar.gz /usr/local/src/centreon-2.4.4.tar.gz
tar zxf centreon-2.4.4.tar.gz
cd centreon-2.4.4
./install.sh -i


GPL许可证,填写y
确定安装centreon几部分模块,全部填写y


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


RRD perl module installed [RRDs.pm]更改为/usr/lib64/perl5/vendor_perl/RRDp.pm
(可以通过 rpm -ql rrdtool-perl 确认,最好验证,不一定是上面的路径)
PEAR [PEAR.php]更改为/usr/share/pear/PEAR.php
(可以通过 rpm -ql php-pear 确认)




What is the Monitoring engine log directory?==>/usr/local/centreon/log
default to [/usr/lib/nagios/plugins] ==>/usr/local/nagios/libexec


What is the Monitoring engine init.d script ?
> /etc/init.d/nagios


What is the Monitoring engine binary ?
> /usr/local/nagios/bin/nagios


What is the Monitoring engine configuration directory ?
> /usr/local/nagios/etc   


Where is the configuration directory for broker module ?
> /usr/local/nagios/etc


Where is the init script for broker module daemon ?
> /etc/init.d/ndo2db


填写相关项目
NDO ndomod binary更改为/usr/local/nagios/bin/ndomod.o


Centreon Run Dir directory更改为/usr/local/centreon/var/run
CentStorage RRD directory更改为/usr/local/centreon/var/lib
CentPlugins lib directory更改为/usr/local/centreon/var/lib/centplugins
 


6)、启动相关服务
cd ../
/etc/init.d/httpd start
/etc/init.d/mysqld start
mysqladmin -u root password '_Y-93iE2'
/etc/init.d/ndo2db start


7)、WEB界面安装
浏览器输入:http://172.27.206.7/centreon/
按照提示完成设置。最后可以登录界面了。




8)启动相关服务
/etc/init.d/nagios start
/etc/init.d/ndo2db restart
/etc/init.d/centcore start
/etc/init.d/centstorage start
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d




/usr/lib/bin/ndo2db-3x -c /usr/local/nagios/etc/ndo2db.cfg






二、客户端服务安装(增加一个Nagios采集服务器)


1)、安装nagios
useradd nagios
groupadd nagcmd
usermod -G nagios,nagcmd nagios
scp root@172.26.159.180:/root/xzy/nagios-3.4.1.tar.gz /usr/local/src/nagios-3.4.1.tar.gz
tar zxf nagios-3.4.1.tar.gz
cd nagios
./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-nanosleep --enable-event-broker 
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
cd ../


2)、安装nagios-plugins
scp root@172.26.159.180:/root/xzy/nagios-plugins-1.4.16.tar.gz /usr/local/src/nagios-plugins-1.4.16.tar.gz
tar zxf nagios-plugins-1.4.16.tar.gz
cd nagios-plugins-1.4.16
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules
make
make install
cd ../


3)、安装nrpe
scp root@172.26.159.180:/root/xzy/nrpe-2.13.tar.gz /usr/local/src/nrpe-2.13.tar.gz
tar zxf nrpe-2.13.tar.gz
cd nrpe-2.13
./configure --with-nrpe-user=nagios --with-nrpe-group=nagios --with-nagios-user=nagios --with-nagios-group=nagios --enable-command-args --enable-ssl
make all
make install-plugin
make install-daemon
make install-daemon-config
cd ../
验证NRPE安装
/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20




4)、安装ndoutils
scp root@172.26.159.180:/root/xzy/ndoutils-1.5.2.tar.gz /usr/local/src/ndoutils-1.5.2.tar.gz
tar zxf ndoutils-1.5.2.tar.gz
cd ndoutils-1.5.2
./configure --prefix=/usr/local/nagios
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
cp daemon-init /etc/init.d/ndo2db


5)增加 /etc/nagio目录 ,复制Centreon上采集服务器的文件到该目录,之前要在Centreon上增加该采集服务器。
6)修改/usr/local/nagios/etc/nagios.cfg文件,增加指向到/etc/nagio的内容
7)增加ndoutile模块加载:
broker_module=/usr/local/nagios/bin/ndomod.o config_file=/etc/nagios/ndomod.cfg
8)增加/usr/lib/nagios/plugins目录,从其他采集服务器,复制目录中脚本到该目录。
9)启动nagios,观察nagios进程号是否传递到Centreon,传递成功,即安装成功。
 类似资料: