2015年(68)
分类: 系统运维
2015-08-31 17:30:24
一、简介:
ICINGA是一个介于Nagios社区版和企业版间的产品,由现有的Nagios项目社区委员会的成员开发维护,完全兼容以前的Nagios应用程序及扩展功能,而icinga-pnp4-cn则是集成了pnp4nagios绘图的icinga中文化项目,界面做得还是相当不错的。至于icinga与nagios的异同,官网( style="font-size:14px;">)有做比较详细的比较,可以上去看看。
二、安装过程:
操作系统是Red Hat Enterprise Linux Server release 6.1,安装中除了icinga-pnp4-cn是编绎安装外,其它所需的软件包都是通过yum来安装,本文最后有rhel6.1的yum源,如果yum源有找不到的rpm包,可以上、上找找。
2.1)准备
添加ICINGA用户:在编译安装时需要指定
#>useradd icinga -s /sbin/nologin
安装所需软件包:
#>yum install freetype libjpeg libpng fontconfig gd gd-devel libjpeg libjpeg-devel libpng libpng-devel net-snmp net-snmp-devel libdbi libdbi-drivers libdbi-dbd-mysql rrdtool-perl php-gd
#>cp /usr/lib64/perl5/RRDs.pm /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi/
#>cp /usr/lib64/perl5/auto/RRDs/RRDs.so /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi/
2.2)安装ICINGA-PNP4-CN
#>wget
#>tar zxvf icinga-pnp4-cn-1.5.1.tar.gz
#>cd icinga-pnp4-cn-1.5.1
#>./configure --prefix=/usr/local/icinga --with-rdbm --with-rdbm-incdir=/usr/include/rdbm/ --with-rdbm-libdir=/usr/lib64/ \
--enable-idoutils --with-web-apache-path=/etc/httpd/conf.d/ --with-perl_lib_path=/usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi \
--with-command-group=icinga --with-command-user=icinga
#>make all
#>make install
#>make install-init #加入到服务中/etc/init.d/
#>make install-api
#>make install-commandmode #生成icinga.cmd
#>make install-idoutils #默认已启用ido2db
#>make install-webconf #生成apache配置文件/etc/httpd/conf.d
#>make install-processperfdata #安装process_perfdata.pl
#>make install-plugins #安装pnp4相关工具
或直接#>make fullinstall #全部安装 #>make install-config #生成配置文件
2.3)添加到系统启动列表中:
#>chkconfig --add icinga
#>chkconfig --level 345 icinga on
2.4)创建MYSQL数据库、导入数据
mysql> CREATE DATABASE icinga;
mysql> GRANT USAGE ON *.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga@xxx' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
mysql> GRANT SELECT , INSERT , UPDATE , DELETE ON icinga.* TO 'icinga'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit
2.5)导入scheme数据到MySQL
#>mysql -u root -p icinga < module/idoutils/db/mysql.sql
2.6)修改IDOUtils配置文件
#>vi /usr/local/icinga/etc/ido2db.cfg
db_servertype=mysql
db_port=3306
db_user=icinga
db_pass=icinga@xxx
2.7)安装nagios-plugins
#>wget
#>tar zxvf nagios-plugins-1.4.15.tar.gz
#>cd nagios-plugins-1.4.15
#>./configure --prefix=/usr/local/icinga --with-cgiurl=/icinga/cgi-bin --with-htmurl=/icinga --with-nagios-user=icinga --with-nagios- group=icinga
#>make && make install
2.8)安装nrpe
#>wget
#>cd icinga-nrpe
#>./configure --prefix=/usr/local/nrpe --with-nrpe-user=icinga --with-nrpe-group=icinga --with-nagios-user=icinga --with-nagios-group=icinga
#>make all && make install
#>cp /usr/local/nrpe/libexec/check_nrpe /usr/local/icinga/libexec/
#>cp /usr/local/nrpe/bin/nrpe /usr/local/icinga/bin
#>cp sample-config/nrpe.cfg /usr/local/icinga/etc/
#>rm -rf /usr/local/nrpe
三、启动、测试
#>/usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg #检测配置有无错误产生
#>/etc/init.d/icinga start
打开测试:默认用户名为icingaadmin,密码为admin; 可自行修改,但必需确保与cgi.cfg中的认证用户保持一致,如htpasswd -c /usr/local/icinga/etc/htpasswd.users admin