環境: CentOS 6.5 64-bit
Download Packages:
----------------------------------------------------------------------------------------
1. http://www.centreon.com/
(1) Centreon Web
http://www.centreon.com/Content-Download/donwload-centreon
2. http://www.nagios.com/
(1) Nagios Core
http://www.nagios.org/download/core/
(2) Nagios Plugins
http://www.nagios.org/download/plugins/
(3) Nagios Addons
NRPE:
http://www.nagios.org/download/addons/
NDOUtils:
http://www.nagios.org/download/addons/
----------------------------------------------------------------------------------------
[root@VM ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[root@VM ~]# wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
[root@VM ~]# rpm --import RPM-GPG-KEY.dag.txt
[root@VM ~]# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[root@VM ~]# yum update
[root@VM ~]# yum upgrade
安裝GD
[root@VM ~]# yum install gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD
安裝MySQL
[root@VM ~]# yum -y install openssl-devel perl-DBD-MySQL mysql-server mysql-devel
安裝PHP
[root@VM ~]# yum -y install php php-mysql php-gd php-ldap php-xml php-mbstring
安裝PERL
[root@VM ~]# yum -y install perl-DBI perl-DBD-MySQL
[root@VM ~]# yum -y install perl-Config-IniFiles
[root@VM ~]# yum -y install php-pear php-pear-DB
安裝RRDTool
[root@VM ~]# yum -y install rrdtool perl-rrdtool
安裝SNMP
[root@VM ~]# yum -y install perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils
[root@VM ~]# yum -y install perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl
安裝編譯相關套件
[root@VM ~]# yum -y install fping cpp gcc gcc-c++ libstdc++ glib2-devel
[root@VM ~]# yum -y install fping
[root@VM ~]# yum -y install php-process php-devel
[root@VM ~]# yum -y mail
------------------------以下指令可以一次做以上的安裝套件-----------------------------
[root@VM ~]# yum install -y 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-DBI perl-DBD-MySQL perl-Config-IniFiles php-pear php-pear-DB 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 fping php-process php-devel mail
--------------------------------------------------------------------------------------------
[root@VM ~]# pear channel-update pear.php.net
[root@VM ~]# pear upgrade-all
[root@VM ~]# useradd nagios
[root@VM ~]# groupadd nagcmd
[root@VM ~]# usermod -G nagios,nagcmd apache
安裝Nagios
[root@VM ~]# tar zxvf nagios-4.0.6.tar.gz
[root@VM ~]# cd nagios-4.0.6
[root@VM nagios-4.0.6]# ./configure --prefix=/usr/local/nagios --with-command-group=nagcmd --enable-nanosleep --enable-broker
[root@VM nagios-4.0.6]# make all
[root@VM nagios-4.0.6]# make install
[root@VM nagios-4.0.6]# make install-init
[root@VM nagios-4.0.6]# make install-commandmode
[root@VM nagios-4.0.6]# make install-config
[root@VM nagios-4.0.6]# make install-webconf
安裝Nagios plugins
[root@VM nagios-4.0.6]# cd ~
[root@VM ~]# tar zxvf nagios-plugins-2.0.2.tar.gz
[root@VM ~]# cd nagios-plugins-2.0.2
[root@VM nagios-plugins-2.0.2]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules
[root@VM nagios-plugins-2.0.2]# make all
[root@VM nagios-plugins-2.0.2]# make install
[root@VM nagios-plugins-2.0.2]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
[root@VM nagios-plugins-2.0.2]# cat /usr/local/nagios/etc/htpasswd.users
[root@VM nagios-plugins-2.0.2]# chkconfig --add nagios
[root@VM nagios-plugins-2.0.2]# chkconfig httpd on
[root@VM nagios-plugins-2.0.2]# chkconfig mysqld on
[root@VM nagios-plugins-2.0.2]# /etc/init.d/mysqld restart
[root@VM nagios-plugins-2.0.2]# mysqladmin -u root password 'mysql'
[root@VM nagios-plugins-2.0.2]# vim /etc/my.cnf
在[mysqld]下加入
innodb_file_per_table=1
[root@VM nagios-plugins-2.0.2]# /etc/init.d/mysqld restart
[root@VM nagios-plugins-2.0.2]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
[root@VM nagios-plugins-2.0.2]# /etc/init.d/httpd restart
[root@VM nagios-plugins-2.0.2]# /etc/init.d/nagios restart
[root@VM nagios-plugins-2.0.2]# cat /usr/local/nagios/var/nagios.log
[root@VM nagios-plugins-2.0.2]# cd ~
[root@VM ~]# tar zxvf nrpe-2.15.tar.gz
[root@VM ~]# cd nrpe-2.15
[root@VM nrpe-2.15]# ./configure
[root@VM nrpe-2.15]# make all
[root@VM nrpe-2.15]# make install-plugin
[root@VM nrpe-2.15]# make install-daemon
[root@VM nrpe-2.15]# make install-daemon-config
[root@VM nrpe-2.15]# vim /usr/local/nagios/etc/nrpe.cfg
allowed_hosts=127.0.0.1
修改為
allowed_hosts=127.0.0.1 192.168.249.130
192.168.249.130為Nagios ip
啟動NRPE
[root@VM nrpe-2.15]# /usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
查看NRPE是否啟動
[root@VM nrpe-2.15]# netstat -nltp | grep nrpe
tcp 0 0 0.0.0.0:5666 0.0.0.0:* LISTEN 33335/nrpe
tcp 0 0 :::5666 :::* LISTEN 33335/nrpe
測試NRPE是否正常
[root@VM nrpe-2.15]# /usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
[root@VM nrpe-2.15]# /usr/local/nagios/libexec/check_users -w 5 -c 10
USERS OK - 3 users currently logged in |users=3;5;10;0
[root@VM nrpe-2.15]# /usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
OK - load average: 0.00, 0.00, 0.00|load1=0.000;15.000;30.000;0; load5=0.000;10.000;25.000;0; load15=0.000;5.000;20.000;0;
安裝NDOUtils
[root@VM nrpe-2.15]# cd ~
[root@VM ~]# tar zxvf ndoutils-2.0.0.tar.gz
[root@VM ~]# cd ndoutils-2.0.0
[root@VM ndoutils-2.0.0]# ./configure --prefix=/usr/local/nagios --enable-mysql --disable-pgsql --with-ndo2db-user=nagios --with-ndo2db-group=nagios
[root@VM ndoutils-2.0.0]# make
[root@VM ndoutils-2.0.0]# make install
複制設定檔案
[root@VM ndoutils-2.0.0]# cat config/ndo2db.cfg-sample|grep lock_file
lock_file=/usr/local/nagios/var/ndo2db.lock
[root@VM ndoutils-2.0.0]# cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
[root@VM ndoutils-2.0.0]# cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
[root@VM ndoutils-2.0.0]# cp src/ndomod-3x.o /usr/local/nagios/bin/
[root@VM ndoutils-2.0.0]# cp src/ndo2db-3x /usr/local/nagios/bin/
[root@VM ndoutils-2.0.0]# chmod 774 /usr/local/nagios/bin/ndo*
[root@VM ndoutils-2.0.0]# chown nagios:nagios /usr/local/nagios/bin/ndo*
[root@VM ndoutils-2.0.0]# chown nagios:nagios /usr/local/nagios/etc/ndo*
[root@VM ndoutils-2.0.0]# cp ./daemon-init /etc/init.d/ndo2db
[root@VM ndoutils-2.0.0]# chmod +x /etc/init.d/ndo2db
[root@VM ndoutils-2.0.0]# chkconfig --add ndo2db
[root@VM ndoutils-2.0.0]# chkconfig --level 345 ndo2db on
[root@VM ndoutils-2.0.0]# /etc/init.d/ndo2db start
測試NDOUtils是否有正常執行
[root@VM ndoutils-2.0.0]# /etc/init.d/ndo2db status
[root@VM ndoutils-2.0.0]# ps -ef | grep ndo2db
nagios 36813 1 0 17:47 ? 00:00:00 /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg
root 36828 2937 0 17:48 pts/1 00:00:00 grep ndo2db
安裝Centreon
[root@VM ndoutils-2.0.0]# cd ~
[root@VM ~]# tar zxvf centreon-2.5.1.tar.gz
[root@VM ~]# cd centreon-2.5.1
[root@VM centreon-2.5.1]# sh install.sh -i
注意:
Where is your Centreon etc directory
default to [/etc/centreon]
> /usr/local/centreon/etc
Where is mail binary
default to [/usr/bin/mail]
> /bin/mail
Where is PEAR [PEAR.php]
default to [/usr/share/php/PEAR.php]
> /usr/share/pear/PEAR.php
What is the Monitoring engine user ?
> nagios
What is the Broker user ? (optional)
> nagios
What is the Monitoring engine log directory ?
> /usr/local/nagios/var
Where is your monitoring plugins (libexec) directory ?
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
登入Centreon
http://192.168.249.130/centreon
頁面三-Monitoring engine information
Monitoring engine選擇nagios
Nagios directory設定/usr/local/nagios
Nagiostats binary設定/usr/local/nagios/bin/nagiostats
Nagios image directory設定/usr/local/nagios/share/images
頁面四-Broker module information
Broker Module選擇ndoutils
Ndomod binary (ndomod.o)設定/usr/local/nagios/bin/ndomod.o
頁面五-Admin information
設定管理員資料
頁面六-Database information
Database Host Address (default: localhost)設定192.168.249.130 或 localhost
輸入原先設定的MySQL密碼mysql
進行以下操作
[root@VM centreon-2.5.1]# /etc/init.d/centcore restart
[root@VM centreon-2.5.1]# /etc/init.d/centstorage restart
[root@VM centreon-2.5.1]# /etc/init.d/ndo2db restart
以上這個指令若不行,請輸入以下指令後,再輸入一次以上的指令
[root@VM centreon-2.5.1]# killall ndo2db
此時,點選Configuration --> Centreon --> Pollers就可以看到Process有啟動了。
參考至: http://56281688.blog.51cto.com/780901/1362447
留言列表