Idoutils is an addon of icinga used to save data to the database. In this article, I try to use MySQL server, and MySQL server has been installed on another machine.
The sever of icinga has been installed before.
1. First install the program required to access MySQL
apt-get install mysql-client libdbi1 libdbi-dev libdbd-mysql
2. log on to the MySQL server and run the following command to create the user 'icinga 'and password:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'icinga'@'%' IDENTIFIED BY '770328' WITH GRANT OPTION;Query OK, 0 rows affected (0.09 sec)
3. Go to the icinga source code directory, clean up and recompile
cd /usr/src/icinga-1.9.0make clean./configure --with-command-group=icinga-cmd --enable-idoutils
I have not enabled SSL.
Some important information will be generated and saved for future convenience:
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. Then run make all to compile
5. Stop icinga
service icinga stop
6. Install
make fullinstallmake install-config
7. Modify the email address of the contact object in the following file to your own address:
/usr/local/icinga/etc/objects/contacts.cfg
8. Some configurations are not described in the official documentation:
Copy from sample,
root@icinga:/usr/local/icinga/etc/modules# cp idoutils.cfg-sample idoutils.cfg
The content does not need to be modified:
define module{ module_name idomod module_type neb path /usr/local/icinga/lib/idomod.so args config_file=/usr/local/icinga/etc/idomod.cfg }
Create a link:
ln -s /usr/lib/icinga/idomod.so /usr/sbin/
Copy the idood. cfg file from the sample.
root@icinga:/usr/local/icinga/etc# cp idomod.cfg-sample idomod.cfg
9. Create a database now.
Copy the database file to the database server:
root@icinga:/usr/src/icinga-1.9.0/module/idoutils# scp -r db root@10.112.18.182:/opt/
Log on to the MySQL server, create a database, and then import the database file:
root@gitlab:/opt/db/mysql# mysql -u root -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 104Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.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> quitByeroot@gitlab:/opt/db/mysql# mysql -u root -p icinga < mysql.sqlEnter password:
10. Configure icinga server to connect to the database
root@icinga:/usr/local/icinga/etc# cp ido2db.cfg-sample ido2db.cfg
Then, set four options:
db_user=icingadb_pass=770328db_servertype=mysqldb_host=10.112.18.182
11. Start the service:
root@icinga:/usr/local/icinga/var# service ido2db startStarting ido2db: done.root@icinga:/usr/local/icinga/var# service icinga start
12. view the log:/usr/local/icinga/var/icinga. log file:
[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...
View System logs:/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 databaseMay 16 11:10:16 icinga icinga: Event loop started...May 16 11:10:16 icinga ido2db: Successfully disconnected from mysql databaseMay 16 11:10:16 icinga ido2db: Successfully shutdown... (PID=8771)