nagios+centreon安装
1. 安装apache:
yum install httpd -y
2.安装GD 库
yum install gd fontconfig-devel libjpeg-devel libpng-devel gd-devel perl-GD -y
3.安装mysql
yum install openssl-devel mysql-server mysql-devel -y
4.安装php
yum install php php-mysql php-gd -y
5.安装php 扩展
yum install php-ldap php-xml php-mbstring php-posix -y
6.安装DBI
yum install perl-DBI perl-DBD-MySQL -y
7.安装perl 模块
yum install perl-devel perl-CPAN -y
8.安装rrdtool
yum install rrdtool perl-rrdtool -y
9.安装SNMP
yum install perl-Crypt-DES perl-Digest-SHA1 perl-Digest-HMAC net-snmp-utils -y
yum install perl-Socket6 perl-IO-Socket-INET6 net-snmp net-snmp-libs php-snmp dmidecode lm_sensors perl-Net-SNMP net-snmp-perl -y
10.安装fping 和一些开发库
yum install fping cpp gcc gcc-c++ libstdc++ glib2-devel -y
11.安装pear
yum install php-pear php-pear-DB -y
pear channel-update pear.php.net
pear upgrade-all
12. 安装nagios
useradd -m nagios -s /sbin/nologin
groupadd nagios
usermod -G nagios apache
wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.3.tar.gz
tar -axf nagios-3.2.3.tar.gz -C /usr/local/src/
cd /usr/local/src/nagios-3.2.3
./configure --prefix=/usr/local/nagios --with-command-group=nagios --enable-nanosleep --enable-broker
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
13. 安装nagios 插件
wget http://ovh.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.15.tar.gz
tar -axf nagios-plugins-1.4.15.tar.gz -C /usr/local/src/
cd /usr/local/src/nagios-plugins-1.4.15
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl=/usr/bin/openssl --enable-perl-modules
make
make install
14.安装NDOutils
wget http://prdownloads.sourceforge.net/sourceforge/nagios/ndoutils-1.4b9.tar.gz
tar -axf ndoutils-1.4b9.tar.gz -C /usr/local/src/
cd /usr/local/src/ndoutils-1.4b9
wget http://svn.centreon.com/trunk/ndoutils-patch/ndoutils1.4b9_light.patch
patch -p1 -N < ndoutils1.4b9_light.patch
./configure --prefix=/usr/local/nagios --enable-mysql --disable-pgsql --with-ndo2db-user=nagios --with-ndo2db-groups=nagios
make
cp ./src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
cp ./src/ndo2db-3x /usr/local/nagios/bin/ndo2db
cp ./config/ndo2db.cfg-sample /usr/local/nagios/etc/ndo2db.cfg
cp ./config/ndomod.cfg-sample /usr/local/nagios/etc/ndomod.cfg
chmod 774 /usr/local/nagios/bin/ndo*
chown nagios:nagios /usr/local/nagios/bin/ndo*
cp ./daemon-init /etc/init.d/ndo2db
vi /etc/init.d/ndo2db
killproc_ndo2db ()
{
#kill $2 $Ndo2dbPID
kill `pidof ndo2db |cut -f1 -d " "` >/dev/null 2>&1
kill `pidof ndo2db |cut -f1 -d " "` >/dev/null 2>&1
}
stop)
echo "Stopping $servicename..."
#pid_ndo2db
killproc_ndo2db
#killproc_ndo2db ndo2db
chmod +x /etc/init.d/ndo2db
chkconfig --add ndo2db
chkconfig --level 35 ndo2db on
可能会报以下错误:
主要是mysql的lib文件依赖。
./configure --prefix=/usr/local/nagios --enable-mysql --with-mysql=/usr/local/services/mysql --disable-pgsql --with-ndo2db-user=nagios --with-ndo2db-groups=nagios
安装ndoutils-1.4b9时报以下错 # ./configure --enable-mysql --with-mysql=/usr/local/mysql # make cd ./src && make make[1]: Entering directory `/root/nagiosddd/ndoutils-1.4b9/src' gcc -fPIC -g -O2 -I/usr/local/mysql/include/mysql -DHAVE_CONFIG_H -c -o io.o io.c In file included from io.c:11: ../include/config.h:261:25: error: mysql/mysql.h: No such file or directory ../include/config.h:262:26: error: mysql/errmsg.h: No such file or directory make[1]: *** [io.o] Error 1 make[1]: Leaving directory `/root/nagiosddd/ndoutils-1.4b9/src' make: *** [all] Error 2
解决方法 # vi include/config.h 将 #include <mysql/mysql.h> #include <mysql/errmsg.h> 修改为 #include </usr/local/mysql/include/mysql/mysql.h> #include </usr/local/mysql/include/mysql/errmsg.h> |
15. 安装centreon
wget http://download.centreon.com/centreon/centreon-2.1.8.tar.gz
tar -axf centreon-2.1.8.tar.gz -C /usr/local/src/
cd /usr/local/src/centreon-2.1.8/
安装的时候需要设定ngios 的可执行文件路径环境:
export PATH="$PATH:/usr/local/nagios/bin/"
./install.sh -i
注意一下几个容易出错的地方:
①、/usr/lib/perl5/RRDs.pm
Where is the RRD perl module installed [RRDs.pm] default to [/usr/lib/perl5/RRDs.pm] > |
解决:
[root@localhost ~]# find / -name RRDs.pm /usr/lib64/perl5/RRDs.pm |
②、/usr/share/php/PEAR.php
Where is PEAR [PEAR.php] default to [/usr/share/php/PEAR.php] > > |
解决:
[root@localhost ~]# find / -name PEAR.php /usr/share/pear/PEAR.php |
③、pear 模块
很多安装没有成功,都是因为必须pear 模块没有安装完全:
提示安装或更新PEAR 模块。这一步选择“y”后,它会自动安装或更新,有的显示“OK”就表示安装成功,对于“NOK”表示没有成功,它会一直循环下去,直到“OK”,此时自动在线安装或更新有可能进行不下去,会一直循环显示,这时,我们选择手动安装。
1)、记下有“NOK”模块,
2)、打开PEAR 官方网站的模块下载网址:
http://pear.php.net/packages.php
3)、查找需要的PEAR 模块软件包:
安装成功与下载的软件版本有很大的关系,请根据提示选择适合的版本。
4)、下载并安装:
pear install 安装包
5)、这时,看原来的终端界面,HTML_QuickForm_advmultiselect 已经“OK”了,按此方法,接着断续安装其它“NOK”的模块。
来源:oschina
链接:https://my.oschina.net/u/727880/blog/312365