Icinga安装配置手册
giser062——2014-11-06
1 Icinga说明
1.1 中文版地址
中文版项目地址
icinga-cn.sourceforge/
下载地址
sourceforge/projects/icinga-cn/files/
1.2 官方安装指南
Icinga with IDOUtils Quickstart
/1.4/en/quickstart-idoutils.html
NRPE
/1.4/en/nrpe.html
1.3 插件下载地址
/directory/Plugins/System-Metrics
1.4 实验环境
操作系统
CentOS 6.5
数据库
MySQL
2 监控主机服务器安装配置
2.1 上传安装包和依赖包
上传路径:
/usr/local/softwares
2.2 安装依赖包
分为在线安装方式及离线安装
2.2.1 在线安装
执行命令,安装依赖:
yum install httpd gcc glibc glibc-common gd gd-devel openssl openssl-devellibjpeg libjpeg-devel libpng libpng-devel
安装MySql:
yum install mysql mysql-server libdbi libdbi-devel libdbi-drivers libdbi-dbd-mysql
2.2.2 离线安装
进入到依赖包路径,执行命令:
安装依赖:
rpm -ivh apr-1.3.9-5.el6_2.x86_64.rpm apr-util-1.3.9-3.el6_0.1.x86_64.rpm apr-util-ldap-1.3.9-3.el6_0.1.x86_64.rpm cloog-ppl-0.15.7-1.2.el6.x86_64.rpm cpp-4.4.7-4.el6.x86_64.rpm e2fsprogs-1.41.12-18.el6_5.1.x86_64.rpm e2fsprogs-libs-1.41.12-18.el6_5.1.x86_64.rpm fontconfig-devel-2.8.0-3.el6.x86_64.rpm freetype-devel-2.3.11-14.el6_3.1.x86_64.rpm gcc-4.4.7-4.el6.x86_64.rpm gd-devel-2.0.35-11.el6.x86_64.rpm glibc-2.12-1.132.el6_5.4.x86_64.rpm glibc-common-2.12-1.132.el6_5.4.x86_64.rpm glibc-devel-2.12-1.132.el6_5.4.x86_64.rpm glibc-headers-2.12-1.132.el6_5.4.x86_64.rpm httpd-2.2.s.x86_64.rpm httpd-tools-2.2.s.x86_64.rpm keyutils-libs-devel-1.4-4.el6.x86_64.rpm krb5-devel-1.10.3-15.el6_5.1.x86_64.rpm krb5-libs-1.10.3-15.el6_5.1.x86_64.rpm krb5-workstation-1.10.3-15.el6_5.1.x86_64.rpm libX11-devel-1.5.0-4.el6.x86_64.rpm libXau-devel-1.0.6-4.el6.x86_64.rpm libXpm-devel-3.5.10-2.el6.x86_64.rpm libcom_err-1.41.12-18.el6_5.1.x86_64.rpm libcom_err-devel-1.4
1.12-18.el6_5.1.x86_64.rpm libjpeg-turbo-1.2.1-3.el6_5.x86_64.rpm libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64.rpm libpng-devel-1.2.49-1.el6_2.x86_64.rpm libselinux-devel-2.0.94-5.3.el6_4.1.x86_64.rpm libsepol-devel-2.0.41-4.el6.x86_64.rpm libss-1.41.12-18.el6_5.1.x86_64.rpm libxcb-devel-1.8.1-1.el6.x86_64.rpm mailcap-2.1.arch.rpm mpfr-2.4.1-6.el6.x86_64.rpm openssl-1.0.1e-16.el6_5.15.x86_64.rpm openssl-devel-1.0.1e-16.el6_5.15.x86_64.rpm ppl-0.10.2-11.el6.x86_64.rpm xorg-x11-proto-devel-7.arch.rpm zlib-devel-1.2.3-29.el6.x86_64.rpm –force
安装MySQL:
rpm -ivh libdbi-0.8.3-4.el6.x86_64.rpm libdbi-dbd-mysql-0.8.3-5.1.el6.x86_64.rpm libdbi-devel-0.8.3-4.el6.x86_64.rpm libdbi-drivers-0.8.3-5.1.el6.x86_64.rpm mysql-5.1.73-3.el6_5.x86_64.rpm mysql-libs-5.1.73-3.el6_5.x86_64.rpm mysql-server-5.1.73-3.el6_5.x86_64.rpm perl-DBD-MySQL-4.013-3.el6.x86_64.rpm perl-DBI-1.609-4.el6.x86_64.rpm --force
2.3 添加icinga用户及用户组
useradd -m icinga
passwd icinga
添加新用户组icinga-cmd,用于从icinga web界面中给icinga发送命令
groupadd icinga-cmd
usermod -a -G icinga-cmd icinga
2.4 编译安装Icinga和IDOUtils
cd /usr/local/softwares
tar -xvf icinga-cn-1.4.0.tar.bz2
cd icinga-cn-1.4.0
2.4.1 运行配置脚本
启用idoutils和ssl
./configure --with-command-group=icinga-cmd --enable-idoutils --enable-ssl
2.4.2 编译
make all
2.4.3 安装
分别执行下面的安装语句:
make install
make install-init
make install-config
make install-commandmode
make install-idoutils
或者直接全部安装:
make fullinstall
2.5 自定义配置
一些简单的配置文件已经被被“make isntall-config”命令安装到目录“/usr/local/icinga/etc/”中。
2.5.1 修改联系邮件地址
vim /usr/local/icinga/etc/objects/contacts.cfg
define contact{
        contact_name                    icingaadmin        ; Short name of user
    use                generic-contact        ; Inherit default values from generic-contact template (defined above)
        alias                          Icinga Admin        ; Full name of user
        email                          liujianliang@longshine    ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }
2.5.2 启用SSL连接及连接配置
vim /usr/local/icinga/etc/idomod.cfg
修改如下内容:
use_ssl=1
output_type=tcpsocket
output=127.0.0.1
其中output为本机服务器ip地址,或者直接127.0.0.1,如果该地址配置为数据库服务器IP地址,则启动后,会报如下错误:
mysql下载libs包的网址
icinga: idomod: Still unable to connect to data sink.  0 items lost, 434 queued items to flush.
vim /usr/local/icinga/etc/ido2db.cfg
修改如下内容:
use_ssl=1
socket_type=tcp
2.5.3 启用idomod事件代理(Event broker)模块
编辑主配置文件,到broker_module并且取消其前面的注释
vim /usr/local/icinga/etc/icinga.cfg
broker_module=/usr/local/icinga/bin/idomod.o config_file=/usr/local/icinga/etc/idomod.cfg
2.6 创建数据库和IDOUtils
2.6.1 启动MySQL数据库
service mysqld start
2.6.2 设置mysql root的密码
mysqladmin -u root -p password "root"
2.6.3 修改MySQL默认编码为utf8
vim /etc/myf
添加:
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
2.6.4 创建Icinga数据库
#> mysql -u root -p
mysql> CREATE DATABASE icinga CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT USAGE ON *.* 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
  ON icinga.* TO 'icinga'@'localhost';
FLUSH PRIVILEGES ;
quit
2.6.5 导入表结构
进入icinga安装目录下的module/idoutils/db/mysql目录
cd /usr/local/softwares/icinga-cn-1.4.0/module/idoutils/db/mysql
注意修改mysql.sql脚本中的字符集为utf8,否则icinga_servicechecks表中的性能数据会乱码
打开mysql.sql文件,全部替换latin1_general_cs为utf8_general_ci,全部替换latin1为utf8
然后导入表结构
mysql -u root -p icinga < mysql.sql
2.6.6 自定义IDOUtils的数据库配置文件
vim /usr/local/icinga/etc/ido2db.cfg
修改信息如下:
db_servertype=mysql
db_host=localhost
db_port=3306
db_user=icinga
db_pass=icinga
注意:其中db_host为数据库服务器IP地址,如果数据库不在本机上,要记得修改。
2.7 配置经典Web界面
2.7.1 编译安装
#> make cgis
#> make install-cgis
#> make install-html
2.7.2 安装配置文件
把icinga经典web界面配置文件安装到apache的conf.d目录中
#> make install-webconf
2.7.3 创建Icinga账号
创建icinga经典web界面登录用户帐号:icingaadmin
#> htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin
2.7.4 修改密码或者添加用户
#> htpasswd /usr/local/icinga/etc/htpasswd.users <USERNAME>
2.7.5 重启Apache,使生效
service httpd restart

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。