icinga 监控中文版 安装部署

运维监控   icinga  

简介

ICINGA,就是一个Nagios开发者独立出去成立的项目,项目野心很大,新的开源项目将完全兼容以前的Nagios应用程序及扩展功能。感觉Icinga界面更为友好、美观,现将安装配置笔记共享。

基本环境

  • 系统
    centoOS 6.5 x64
  • Apache + Php + Mysql
  • GD 开发库

安装软件包

  • 一键安装所有需要的软件包
yum install xz mutt lrzsz bc sysstat httpd gcc glibc glibc-common gd gd-devel libjpeg libjpeg-devel libpng libpng-devel rrdtool rrdtool-devel perl-rrdtool perl perl-devel php php-devel php-gd mysql mysql-server libdbi libdbi-devel libdbi-drivers libdbi-dbd-mysql perl-Time-HiRes openssl openssl-devel php-pear php-xmlrpc php-xsl php-soap php-mysql php-pdo php-gd php-mbstring -y  
  • 修改php时区修改apache所属用户组
sed -i 's#;date.timezone =#date.timezone = PRC#g' /etc/php.ini  
sed -i 's#User apache#User www#g' /etc/httpd/conf/httpd.conf  
sed -i 's#Group apache#Group www#g' /etc/httpd/conf/httpd.conf  
  • 启动apache和Mysql,并初始化mysql管理密码
service mysqld start  
service httpd start  
mysqladmin -u root password 123456  

安装Icinga-pnp4(包括IDOUtils)

tar xf icinga-pnp4-cn-1.11.5.tar.xz  
cd icinga-pnp4-cn-1.11.5  
./configure --prefix=/usr/local/icinga --with-icinga-user=www --with-icinga-group=www --with-command-user=www --with-command-group=www --with-mail=/usr/bin/mutt --with-perl_lib_path=/usr/lib64/perl5 --with-libdbi-driver-dir=/usr/lib64/ --enable-perfdata --enable-nanosleep --enable-event-broker
make all  
make install  
make install-init  
make install-commandmode  
make install-eventhandlers  
make install-idoutils  
make install-config  
make install-webconf  
make install-webconf-auth  
make install-processperfdata  
make install-plugins

make cgis  
make install-cgis  
make install-html  
  • 数据库创建和授权
mysql -uroot -p123456 -e "CREATE DATABASE icinga;"  
mysql -uroot -p123456 -e "GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' identified by 'icinga123';"  
mysql -uroot -p123456 -e "flush privileges;"  
mysql -uroot -p123456 icinga < icinga-pnp4-cn-1.11.5/module/idoutils/db/mysql/mysql.sql  
  • 编辑DB配置文件自定义IDOUtils,修改ido2db连接用户
    sed -i s#db_pass=icinga#db_pass=icinga123#g /usr/local/icinga/etc/ido2db.cfg

编译和安装Icing插件

tar xf nagios-cn-plugins-2.0.3.tar.xz  
cd nagios-cn-plugins-2.0.3  
./configure --prefix=/usr/local/icinga --with-package-name=icinga-plugins --with-cgiurl=/icinga/cgi-bin --with-nagios-user=www --with-nagios-group=www
make && make install  

安装check_nrpe 插件

  • 编译安装
tar zxf nrpe-2.15.tar.gz  
cd nrpe-2.15  
./configure --prefix=/usr/local/icinga --enable-ssl --with-nrpe-user=www --with-nrpe-group=www --with-nagios-user=www --with-nagios-group=www --enable-command-args
make all && make install-plugin  
make install-daemon  
make install-daemon-config  
  • 启动 nrpe
    /usr/local/icinga/bin/nrpe -c /usr/local/icinga/etc/nrpe.cfg -d

启动IDOUtils和Icinga

service ido2db start  
service icinga start  

报错解决

  • /var/lib/php/session 权限不足,因为默认所属的是apache
    chown root.www /var/lib/php/session -R

  • icinga pnp4 检查通过后改名
    mv /usr/local/icinga/share/install.php /usr/local/icinga/share/install.php.bak

  • 如果之前在用nagios直接把配置文件迁移过来就可以完美使用了

上几个图看看