Dies ist eine alte Version des Dokuments!
Icinga kann dank einer Erweiterung namens IDOutils auf vielen verschiedenen Datenbanksystemen betrieben werden. Neben MySQL und PostgreSQL kann es auch auf Oracle verwendet werden - besonders interessant ist dies für Firmen, die aus supportechnischen Gründen auf Oracle setzen.
Dieses Tutorial widmet sich der Installation eines Oracle 10g Database Express- und Icinga-Monitoringsystems. Als Betriebssystem wird CentOS 5.5 verwendet, welches binärkompatibel zu RedHat Enterprise Linux ist. Folglich dürfte dieser Leitfaden auch beim Nachbau auf Produktivsystemen mit RHEL und Oracle Database Standard unterstützen.
Für dieses Szenario wird benötigt:
Zuerst wird die Oracle 10g Database Express Edition Software installiert - diese Version ist gegenüber der Standard-Version von Oracle Database abgespeckt und für Evaluationen, wie diese, gedacht. Sie kann kostenfrei auf der Oracle-Webseite bezogen werden.
Ich setze vorraus, dass CentOS 5.5 bereits installiert wurde. Benötigt wird das Paket oracle-xe-univ-10.2*.i386.rpm von der Oracle-Webseite.
Nachdem das Paket heruntergeladen wurde, kann es mittels yum installiert werden - danach wird die Datenbank konfiguriert:
# yum localinstall --nogpgcheck oracle-xe-univ-10.2*.i386.rpm ... Is this ok [y/N]: y ... Complete! # /etc/init.d/oracle-xe configure Oracle Database 10g Express Edition Configuration ------------------------------------------------- This will configure on-boot properties of Oracle Database 10g Express Edition. The following questions will determine whether the database should be starting upon system boot, the ports it will use, and the passwords that will be used for database accounts. Press <Enter> to accept the defaults. Ctrl-C will abort. Specify the HTTP port that will be used for Oracle Application Express [8080]: Specify a port that will be used for the database listener [1521]: Specify a password to be used for database accounts. Note that the same password will be used for SYS and SYSTEM. Oracle recommends the use of different passwords for each database account. This can be done after initial configuration: Confirm the password: Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]: Starting Oracle Net Listener...Done Configuring Database...Done Starting Oracle Database 10g Express Edition Instance...Done Installation Completed Successfully. To access the Database Home Page go to "http://127.0.0.1:8080/apex"
# source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh # sqlplus SQL*Plus: Release 10.2.0.1.0 - Production on Mi Dez 29 15:12:48 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Benutzernamen eingeben: system Kennwort eingeben: Verbunden mit: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE); PL/SQL-Prozedur erfolgreich abgeschlossen. SQL> exit Verbindung zu Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production beendet
Die Firewall, falls verwendet, muss angepasst werden, damit Zugriff auf TCP-Port 8080 möglich ist:
# iptables -A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT # service iptables save # service iptables restart
Nach einem Neustart des Dienstes steht der externe Zugriff zur Verfügung:
/etc/init.d/oracle-xe restart
Bevor Icinga kompiliert wird, bedarf es noch einiger Vorbereitungen:
Es müssen noch einige Bibliotheken installiert werden, die bei der Kompilierung benötigt werden:
# yum install gcc gcc-c++ httpd gd gd-devel glibc glibc-common libjpeg libjpeg-devel libpng libpng-devel openldap-devel php net-snmp net-snmp-devel net-snmp-utils openssl openssl-devel
SELinux behindert Icinga in seiner Funktionsweise, es kann bei der Benutzung der Weboberfläche zu „Internal Server Error“-Meldungen kommen, wenn SELinux aktivert ist. Je nach Firmenvorschriften empfiehlt sich eine Anpassung oder Deaktivierung von SELinux. Es gibt die Möglichkeit für die von Icinga verwendeten CGI-Skripts Ausnahmen zu definieren (siehe „Kompilierung“) - alternativ kann über das CentOS-/RedHat Setup-Werkzeug SELinux deaktiviert werden. Auch eine Anpassung über die Kommandozeile ist einfach möglich:
# setenforce 0 # nano /etc/selinux/config ... SELINUX=disabled
Damit Icinga auf der Oracle-Datenbank agieren kann, wird eine Bibliothek namens ocilib benötigt. Der Quellcode dieser Bibliothek kann kostenfrei auf der Orclib-Projektseite bezogen werden.
Damit die benötigte Oracle-Bibliothek kompiliert werden kann, werden der Oracle Instant Client und das Linux SDK benötigt. Beides erhält man ebenfalls kostenfrei in der passenden Rubrik auf der Oracle-Webseite.
~# yum localinstall --nogpgcheck oracle-instantclient11*basic*.rpm ~# yum localinstall --nogpgcheck oracle-instantclient11.2-devel*.rpm ~# yum localinstall --nogpgcheck oracle-instantclient11.2-sqlplus*.rpm ~# yum localinstall --nogpgcheck oracle-instantclient11.2-tools*.rpm ~# unzip instantclient-sdk-linux32*.zip
Wenn der Oracle Instantclient installiert und das SDK entpackt wurden, kann das muntere Kompilieren beginnen:
~# tar xvfz ocilib-3.8.1-gnu.tar.gz ~# cd ocilib-3.8.1 ~# export LD_LIBRARY_PATH="/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib:/usr/lib/oracle/11.2/client/lib:/usr/local/lib" ~# source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh ocilib-3.8.1# ./configure --with-oracle-headers-path=/root/instantclient_11_2/sdk/include --with-oracle-lib-path=/usr/lib/oracle/11.2/client/lib ocilib-3.8.1# make ocilib-3.8.1# make install
Im Archiv befindet sich auch ein Beispielprogramm, welches die Verbindung zu einer Oracle-Instanz testet. Wenn dieses funktioniert, kann fortgefahren werden:
ocilib-3.8.1# cd demo demo# make -f Makefile_demo demo gcc -I/usr/local/include -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -c -o ocilib_demo.o ocilib_demo.c gcc -L/usr/lib/oracle/11.2/client/lib -lclntsh -L/usr/local/lib -locilib -o demo ocilib_demo.o demo# ./demo xe system <Passwort> ... 0 errors 0 warnings press any key to exit...
Zunächst werden eine Benutzerkonto und eine zugehörige Gruppe für den Icinga-Daemon erstellt - für die Bedienung des Dienstes über die Weboberfläche wird eine dedizierte Gruppe erstellt - dieser Gruppe wird das Apache-Benutzerkonto hinzugefügt.
# useradd -m icinga # passwd icinga ... # groupadd icinga # groupadd icinga-cmd # usermod -a -G icinga-cmd icinga # usermod -a -G icinga-cmd apache
# ln -s /usr/lib/oracle/11.2/client/lib/libclntsh.so.11.1 /usr/lib/libclntsh.so.11.1
# ldd /usr/local/lib/libocilib.so.3.8.1
linux-gate.so.1 => (0x00e17000)
libclntsh.so.11.1 => /usr/lib/libclntsh.so.11.1 (0x00f3d000)
libc.so.6 => /lib/libc.so.6 (0x00110000)
libnnz11.so => not found
libdl.so.2 => /lib/libdl.so.2 (0x00269000)
libm.so.6 => /lib/libm.so.6 (0x00d88000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00a24000)
libnsl.so.1 => /lib/libnsl.so.1 (0x006e6000)
libaio.so.1 => /usr/lib/libaio.so.1 (0x0026e000)
/lib/ld-linux.so.2 (0x00801000)
TODO: LINK ENTFERNEN
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/11.2/client/lib
#export LD_LIBRARY_PATH="/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib:/usr/lib/oracle/11.2/client/lib:/usr/local/lib"
cd demo
make -f Makefile_demo demo
gcc -L/usr/lib/oracle/11.2/client/lib -lclntsh -L/usr/local/lib -locilib -o demo ocilib_demo.o
./demo
*** Configuration summary for icinga-core 1.3.0 02-16-2011 ***:
General Options:
-------------------------
Icinga executable: icinga
Icinga user/group: icinga,icinga
Command user/group: icinga,icinga-cmd
Embedded Perl: no
Event Broker: yes
Build IDOUtils: yes
Install ${prefix}: /usr/local/icinga
Lock file: ${prefix}/var/icinga.lock
Check result directory: ${prefix}/var/spool/checkresults
Init directory: /etc/rc.d/init.d
Apache conf.d directory: /etc/httpd/conf.d
Mail program: /bin/mail
Host OS: linux-gnu
Web Interface Options:
------------------------
HTML URL: http://localhost/icinga/
CGI URL: http://localhost/icinga/cgi-bin/
Traceroute (used by WAP): /bin/traceroute
Review the options above for accuracy. If they look okay,
type 'make all' to compile the main program and CGIs.
!!! Please take care about the upgrade documentation !!!
GIT
# cd /usr/src # w3m http://sourceforge.net/projects/icinga/files/icinga/1.3.0/icinga-1.3.0.tar.gz/download # tar xvfz icinga-1.3.0.tar.gz ... # cd icinga-1.3.0 # ./configure --with-command-group=icinga-cmd --enable-idoutils --enable-ssl --enable-oracle --with-ocilib-inc=/root/ocilib-3.8.1/include ==> INSERT
icinga-1.3.0 # make ... icinga-1.3.0 # make fullinstall ... icinga-1.3.0 # make install-config ... icinga-1.3.0 # cp module/idoutils/db/oracle/oracle.sql $ORACLE_HOME
icinga-1.3.0 # cd /usr/local/icinga/etc etc # nano objects/contacts.cfg ==> MAIL etc # mv idomod.cfg-sample idomod.cfg etc # mv ido2db.cfg-sample ido2db.cfg etc # nano idomod.cfg ... use_ssl=1 output_type=tcpsocket output=127.0.0.1 ... etc # nano ido2db.cfg ... use_ssl=1 socket_type=tcp ... db_servertype=oracle db_port=1521 db_user=icinga db_pass=test123 ... etc # nano /usr/local/icinga/etc/icinga.cfg ... broker_module=/usr/local/icinga/bin/idomod.o config_file=/usr/local/icinga/etc/idomod.cfg ... etc # su - oracle su - oracle -bash-3.2$ cd $ORACLE_HOME -bash-3.2$ source /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh -bash-3.2$ sqlplus Benutzer/Passwort SQL> @oracle.sql ... SQL> quit -bash-3.2$ exit etc # cd /usr/src/icinga-1.3.0 icinga-1.3.0 # make cgis icinga-1.3.0 # make install-cgis icinga-1.3.0 # make install-html icinga-1.3.0 # make install-webconf icinga-1.3.0 # htpasswd -c /usr/local/icinga/etc/htpasswd.users icingaadmin New password: Re-type new password: Adding password for user icingaadmin icinga-1.3.0 # service httpd restart
# iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT # service iptables save # service iptables restart
# cd /usr/src src # links http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.15/nagios-plugins-1.4.15.tar.gz/download?use_mirror=netcologne src # tar xvfz nagios-plugins-1.4.15.tar.gz src # cd nagios-plugins-1.4.15 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 ... nagios-plugins-1.4.15 # make ... nagios-plugins-1.4.15 # make install ...
# ln -s /usr/lib/oracle/11.2/client/lib/libnnz11.so /usr/lib/libnnz11.so # service ido2db start ido2db PID not running. Removing lockfile. Starting ido2db: done. # chkconfig --add ido2db # chkconfig ido2db on # /usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg ... Things look okay - No serious problems were detected during the pre-flight check # service icinga start # chkconfig --add icinga # chkconfig icinga on