安装IDOUtils addon

IDOUtils是icinga的一个addon,用来将数据保存到数据库中,本文我尝试着采用mysql server,并且mysql server采用另一台机器上已经安装好的。

icinga的sever之前已经安装好了。

1. 先安装访问mysql需要的程序

apt-get install mysql-client libdbi1 libdbi-dev libdbd-mysql

2. 登录mysql server,用下面的命令创建用户'icinga'和密码:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'icinga'@'%' IDENTIFIED BY '770328' WITH GRANT OPTION;
Query OK, 0 rows affected (0.09 sec)

3. 进入icinga的源代码目录,清理并重新编译

cd /usr/src/icinga-1.9.0
make clean
./configure --with-command-group=icinga-cmd --enable-idoutils 

我并没有启用SSL。

会产生一些重要信息,保存下来,以后方便:

 General Options:
 -------------------------
        Icinga executable:  icinga
        Icinga user/group:  icinga,icinga
       Command user/group:  icinga,icinga-cmd
        Apache user/group:  www-data,www-data
            Embedded Perl:  no
             Event Broker:  yes
          ido2db lockfile:  ${prefix}/var/ido2db.lock
             ido sockfile:  ${prefix}/var/ido.sock
          idomod tempfile:  ${prefix}/var/idomod.tmp
           Build IDOUtils:  libdbi, instance_name=default
        libdbi driver dir:  /usr/local/lib/dbd
        Install ${prefix}:  /usr/local/icinga
                Lock file:  ${prefix}/var/icinga.lock
                Temp file:  /tmp/icinga.tmp
                 Chk file:  ${prefix}/var/icinga.chk
           HTTP auth file:  ${prefix}/etc/htpasswd.users
            Lib directory:  ${exec_prefix}/lib
            Bin directory:  ${exec_prefix}/bin
         Plugin directory:  ${exec_prefix}/libexec
   Eventhandler directory:  ${exec_prefix}/libexec/eventhandlers
            Log directory:  ${prefix}/var
   Check result directory:  ${prefix}/var/spool/checkresults
           Temp directory:  /tmp
          State directory:  ${prefix}/var
   Ext Cmd file directory:  ${prefix}/var/rw
           Init directory:  /etc/init.d
  Apache conf.d directory:  /etc/apache2/conf.d
       Apache config file:  /etc/apache2/conf.d/icinga.conf
             Mail program:  /bin/mail
                  Host OS:  linux-gnu
       Environment Prefix:  ICINGA_

 Web Interface Options:
 ------------------------
                 HTML URL:  http://localhost/icinga/
                  CGI URL:  http://localhost/icinga/cgi-bin/
                 Main URL:  http://localhost/icinga/cgi-bin/tac.cgi


4. 然后运行make all 编译

5. 停止icinga

service icinga stop

6. 安装

make fullinstall
make install-config

7. 修改下面文件里面的contact对象的email地址为你自己的地址:
/usr/local/icinga/etc/objects/contacts.cfg


8. 一些配置,官方文档上没有描述:

从sample中复制出来,

root@icinga:/usr/local/icinga/etc/modules# cp idoutils.cfg-sample idoutils.cfg
内容倒不需要修改:

define module{
        module_name     idomod
        module_type     neb
        path            /usr/local/icinga/lib/idomod.so
        args            config_file=/usr/local/icinga/etc/idomod.cfg
        }

创建一个链接:

ln -s /usr/lib/icinga/idomod.so /usr/sbin/

再从sample中复制一出idood.cfg文件

root@icinga:/usr/local/icinga/etc# cp idomod.cfg-sample idomod.cfg


9. 现在创建数据库。

首先复制数据库文件到数据库服务器上:

root@icinga:/usr/src/icinga-1.9.0/module/idoutils# scp -r db [email protected]:/opt/

然后登录到mysql 服务器,创建数据库, 然后倒入数据库文件:

root@gitlab:/opt/db/mysql# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 104
Server version: 5.5.28-0ubuntu0.12.10.2 (Ubuntu)

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE DATABASE icinga;
Query OK, 1 row affected (0.02 sec)

mysql> quit
Bye
root@gitlab:/opt/db/mysql# mysql -u root -p icinga < mysql.sql
Enter password: 


10. 配置icinga server连接数据库

root@icinga:/usr/local/icinga/etc# cp ido2db.cfg-sample ido2db.cfg

然后设置四个选项:

db_user=icinga
db_pass=770328
db_servertype=mysql
db_host=10.112.18.182


11. 启动服务:

root@icinga:/usr/local/icinga/var# service ido2db start
Starting ido2db: done.
root@icinga:/usr/local/icinga/var# service icinga start

12. 查看日志:/usr/local/icinga/var/icinga.log文件:

[1368673816] idomod: Successfully connected to data sink.  289 queued items to flush.
[1368673816] idomod: Successfully flushed 289 queued items to data sink.
[1368673816] Successfully shutdown... (PID=8697)
[1368673816] idomod: Shutdown complete.
[1368673816] Event broker module '/usr/local/icinga/lib/idomod.so' deinitialized successfully.
[1368673816] Icinga 1.9.0 starting... (PID=8780)
[1368673816] Local time is Thu May 16 11:10:16 CST 2013
[1368673816] LOG VERSION: 2.0
[1368673816] idomod: IDOMOD 1.9.0 (05-07-2013) Copyright(c) 2005-2008 Ethan Galstad, Copyright(c) 2009-2013 Icinga Development Team (https://www.icinga.org)
[1368673816] idomod: Successfully connected to data sink.  0 queued items to flush.
[1368673816] Event broker module 'IDOMOD' version '1.9.0' from '/usr/local/icinga/lib/idomod.so' initialized successfully.
[1368673816] Finished daemonizing... (New PID=8785)
[1368673816] Event loop started...

查看系统日志:/var/log/syslog

May 16 11:10:16 icinga icinga: idomod: IDOMOD 1.9.0 (05-07-2013) Copyright(c) 2005-2008 Ethan Galstad, Copyright(c) 2009-2013 Icinga Development Team (https://www.icinga.org)
May 16 11:10:16 icinga ido2db: Client connected, data available.
May 16 11:10:16 icinga icinga: idomod: Successfully connected to data sink.  0 queued items to flush.
May 16 11:10:16 icinga ido2db: Handling client connection...
May 16 11:10:16 icinga icinga: Event broker module 'IDOMOD' version '1.9.0' from '/usr/local/icinga/lib/idomod.so' initialized successfully.
May 16 11:10:16 icinga icinga: Finished daemonizing... (New PID=8785)
May 16 11:10:16 icinga ido2db: Successfully connected to mysql database
May 16 11:10:16 icinga icinga: Event loop started...
May 16 11:10:16 icinga ido2db: Successfully disconnected from mysql database
May 16 11:10:16 icinga ido2db: Successfully shutdown... (PID=8771)





 

你可能感兴趣的:(安装IDOUtils addon)