环境:CentOS6.4、icinga-cn-plugins-1.4.16.tar.bz2、icinga-nrpe-2.14.tar.gz、icinga-pnp4-cn-1.9.3.tar.bz2、nagios-cn-plugins-1.5.tar.bz2
#安装环境包
yum -y install gcc gcc-c++ cmake autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glibc-common gd gd-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel libidn libidn-devel openssl openssl-devel rrdtool rrdtool-devel perl-rrdtool perl perl-devel httpd httpd-devel httpd-manual mod_ssl mod_perl mod_auth_mysql mysql mysql-server mysql-devel libdbi libdbi-devel libdbi-drivers libdbi-dbd-mysql php php-gd php-mysql php-perl php-devel php-mcrypt libmcrypt php-mysql php-xml php-pdo php-pear php-mbstring php-pear php-xmlrpc php-bcmath php-snmp lm_sensors lm_sensors-devel perl-DBD-MySQL net-snmp net-snmp-utils net-snmp-perl net-snmp-devel beecrypt-devel perl-Time-HiRes
#创建用户
/usr/sbin/useradd -m icinga
passwd icinga
/usr/sbin/groupadd icinga
/usr/sbin/usermod -a -G icinga apache
#安装Icinga-pnp4(包括IDOUtils)
tar jxvf icinga-pnp4-cn-1.9.3.tar.bz2
cd icinga-pnp4-cn-1.9.3
make distclean
./configure --prefix=/usr/local/icinga --with-icinga-user=icinga --with-icinga-group=icinga --with-command-user=icinga --with-command-group=icinga --with-mail=/usr/bin/mutt --with-httpd-conf=/etc/httpd/conf.d --with-perl_lib_path=/usr/lib/perl5 --with-libdbi-driver-dir=/usr/local/libdbi --enable-nanosleep --enable-event-broker
make all
make fullinstall
make install-config
#数据库创建和IDOUtils
/etc/init.d/mysqld start #启动mysql数据库
mysql -u root -p #进入mysql命令行
#----运行下面的SQL-----
CREATE DATABASE icinga;
GRANT USAGE ON icinga.* TO 'icinga'@'localhost'
IDENTIFIED BY 'icinga'
WITH MAX_QUERIES_PER_HOUR 0
MAX_CONNECTIONS_PER_HOUR 0
MAX_UPDATES_PER_HOUR 0;
GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE
ON icinga.* TO 'icinga'@'localhost';
FLUSH PRIVILEGES;
quit
#----------------------
cd ~/icinga/icinga-pnp4-cn-1.9.3/module/idoutils/db/mysql/
mysql -u root -p icinga < mysql.sql #导入数据库
#配置经典的Web界面
make cgis
make install-cgis
make install-html
make install-webconf
htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin
service httpd restart
#编译和安装Icing插件
tar jxvf nagios-cn-plugins-1.5.tar.bz2
cd nagios-cn-plugins-1.5
#./configure --prefix=/usr/local/icinga --with-package-name=icinga-plugins --with-cgiurl=/icinga/cgi-bin --with-icinga-user=icinga --with-icinga-group=icinga
./configure --with-command-group=nagcmd
make
make install
#安装check_nrpe 插件
tar -zxvf icinga-nrpe-2.14.tar.gz
cd icinga-nrpe-2.14
./configure --prefix=/usr/local/icinga --enable-ssl
make all
make install-plugin
#启动IDOUtils和Icinga
service ido2db start
/usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg
service icinga start
chkconfig --level 35 httpd on
chkconfig --level 35 mysqld on
chkconfig --level 35 ido2db on
chkconfig --level 35 icinga on