ROOT ON FIRE Security, Monitoring, Networking, Linux

16Feb/100

HowTo: Icinga und IDOUtils mit MySQL installieren

icinga logoDie Installation und Konfiguration von Icinga ohne IDOUtils habe ich hier erklärt.

I. Requirements

- Apache
- GCC-Compiler
- C/C++ development libraries
- GD-Development-Libraries für statusmap- und trends-CGIs
- libdbi & libdbi-Treiber

Installation unter Debian 5:

r-o-f:~# aptitude install apache2 build-essential libgd2-xpm-dev
r-o-f:~# aptitude install libjpeg62 libjpeg62-dev libpng12-0 libpng12-0-dev
r-o-f:~# aptitude install mysql-server mysql-client libdbi0 libdbi0-dev libdbd-mysql

II. Pakete herunterladen, validieren und entpacken

Download Icingia Core inkl. MD5 Sums:

r-o-f:~# wget http://downloads.sourceforge.net/project/icinga/icinga/1.0/icinga-1.0.tar.gz
r-o-f:~# http://sourceforge.net/projects/icinga/files/icinga/1.0/icinga-1.0.tar.gz.md5/download

validieren:

r-o-f:~# md5sum -c icinga-1.0.tar.gz.md5
icinga-1.0.tar.gz: OK

entpacken:

r-o-f:~# tar xvzf icinga-1.0.tar.gz

III. Icinga Benutzer und Gruppe anlegen, Passwort definieren

Benutzer anlegen und Passwort definieren:

r-o-f:~# useradd -m icinga
r-o-f:~# passwd icinga
Geben Sie ein neues UNIX-Passwort ein:
Geben Sie das neue UNIX-Passwort erneut ein:
passwd: Passwort erfolgreich geändert

Gruppe für Webinterface definieren und User hinzufügen:

r-o-f:~# groupadd icinga-cmd
r-o-f:~# usermod -a -G icinga-cmd icinga
r-o-f:~# usermod -a -G icinga-cmd www-data

IV. Kompilieren und Installieren

r-o-f:~# cd ./icinga-1.0
r-o-f:~# ./configure --with-command-group=icinga-cmd --enable-idoutils
...

*** Configuration summary for icinga-core 1.0 12-16-2009 ***:

 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/init.d
  Apache conf.d directory:  /etc/apache2/conf.d
             Mail program:  /usr/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):  /usr/sbin/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 !!!
...
r-o-f:~# make all
...
r-o-f:~/icinga-1.0# make fullinstall

Mit make fullinstall wird das Hauptprogramm, CGIs, API, HTML Files, Init-Scripte (/etc/init.d/) installiert und die Berechtigungen für das External-Command-Verzeichnis gesetzt.
Unter /usr/local/icinga/etc wird eine Beispielkonfiguration angelegt. Zusätzlich wird unter /etc/apache2/conf.d/icinga.conf die Konfiguration für das Web-Interface plaziert. Danach muss der Webserver neu gestartet werden.

V. User für Web-Interface definieren

r-o-f:~# htpasswd -c /usr/local/icinga/etc/htpasswd.users root-on-fire
New password:
Re-type new password:
Adding password for user root-on-fire

Mit dem -c Parameter legt htpasswd die htpasswd.users Datei neu an bzw. überschreibt ohne Nachfrage das alte File!
Weitere user können ganz einfach mit folgendem Befehl angelegt werden:

r-o-f:~# htpasswd /usr/local/icinga/etc/htpasswd.users admin

VI. Kontakt & Berechtigungen definieren

Icinga regelt die Benutzerberechtigung wie Nagios über die Kontaktgruppen. Der Web-User muss in einer der definierten Kontaktgruppen sein. Sonst kann er sich zwar einloggen, wird aber nichts sehen.
Ein neuer Kontakt kann in der /usr/local/icinga/etc/objects/contacts.cfg definiert werden:

define contact{
        contact_name                    root-on-fire
        use                             generic-contact  
        alias                           ROOT ON FIRE
        email                           icinga@root-on-fire.com
        }
....

define contactgroup{
        contactgroup_name               admins
        alias                           Icinga Administrators
        members                         icingaadmin,root-on-fire
        }

Detailierte Web-Berechtigungen werden in der /usr/local//icinga/etc/cgi.cfg definiert.

VII. MySQL Datenbank und IDOUtils konfigurieren

Datenbank, Benutzer und Berechtigungen definieren:

r-o-f:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 33
Server version: 5.0.51a-24+lenny3 (Debian)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

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

mysql>  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;
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT SELECT , INSERT , UPDATE , DELETE ON icinga.* TO 'icinga'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql>  FLUSH PRIVILEGES ;
Query OK, 0 rows affected (0.00 sec)

Datenbankstruktur importieren:

r-o-f:~# mysql -u root -p icinga < ./icinga-1.0/module/idoutils/db/mysql.sql

IDOUtils Datenbank definieren:

r-o-f:~# cd /usr/local/icinga/etc/
r-o-f:/usr/local/icinga/etc# cp ido2db.cfg-sample ido2db.cfg

Folgende Optionen müssen in der /usr/local/icinga/etc/ido2db.cfg evtl. angepasst werden:

 db_servertype=mysql
 db_port=3306
 db_user=icinga
 db_pass=<PASSWORT>


VIII. Nagios Plugins herunterladen, kompilieren und installieren

r-o-f:~# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
r-o-f:~# tar xvzf nagios-plugins-1.4.14.tar.gz
r-o-f:~# cd ./nagios-plugins-1.4.14
r-o-f:~/nagios-plugins-1.4.14# ./configure --prefix=/usr/local/icinga --with-nagios-user=icinga
r-o-f:~/nagios-plugins-1.4.14# make
r-o-f:~/nagios-plugins-1.4.14# make install

IX. Icinga & IDOUtils starten

Konfiguration überprüfen:

r-o-f:~# /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

WICHTIG: IDOUtils muss vor Icinga gestartet werden!

r-o-f:~# /etc/init.d/ido2db start
Starting ido2db: done.
...

r-o-f:~# /etc/init.d/icinga start
Starting icinga: done.

X. Firewalleinstellungen

Zugriff auf Web-Interface von außen ermöglichen:

r-o-f:~# iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT

Regel prüfen:

r-o-f:~# iptables  -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere            tcp dpt:www
....

XI. Screenshots

icinga01

icinga02

Quellen und weiterführende Links

Icinga Homepage: http://www.icinga.org/
Icinga Dokumentation: http://docs.icinga.org/
Icinga Demo: http://www.icinga.org/
Deutsche Nagios & Icinga Community: http://www.nagios-portal.org
Nagios Homepage: http://nagios.org/
Nagios-Plugins: http://nagios.org/download/plugins

17Dez/090

Quick & Dirty: Icinga 1.0 Installation

icinga_logoI. Folgende Pakete werden benötigt um Icinga zu installieren:
- Webserver: apache
- GCC-Compiler
- C/C++ development libraries
- GD -Development-Libraries für statusmap- und trends-CGIs

r-o-f:~# aptitude install apache2 build-essential libgd2-xpm-dev libjpeg62 libjpeg62-dev libpng12 libpng12-dev

II. Pakete herunterladen, validieren und entpacken

r-o-f:~# wget http://sourceforge.net/projects/icinga/files/icinga/1.0/icinga-1.0.tar.gz/download
r-o-f:~# wget http://sourceforge.net/projects/icinga/files/icinga/1.0/icinga-1.0.tar.gz.md5/download
r-o-f:~# md5sum -c icinga-1.0.tar.gz.md5
icinga-1.0.tar.gz: OK
r-o-f:~# tar xvzf icinga-1.0.tar.gz

III. Icinga Benutzer und Gruppe anlegen, Passwort definieren

r-o-f:~# useradd -m icinga
r-o-f:~# passwd icinga
Geben Sie ein neues UNIX-Passwort ein:
Geben Sie das neue UNIX-Passwort erneut ein:
passwd: Passwort erfolgreich geändert

r-o-f:~# ls -l /home/
insgesamt 24
drwxr-xr-x 2 icinga icinga  4096 17. Dez 19:18 icinga

Mit -m Parameter bei useradd wird gleichzeitig ein gleichnamiges Homeverzeichnis angelegt.

IV. Kompilieren und Installieren

r-o-f:~# cd icinga-1.0
r-o-f:~/icinga-1.0# ./configure
....
*** Configuration summary for icinga-core 1.0 12-16-2009 ***:

 General Options:
 -------------------------
        Icinga executable:  icinga
        Icinga user/group:  icinga,icinga
       Command user/group:  icinga,icinga
            Embedded Perl:  no
             Event Broker:  yes
           Build IDOUtils:  no
        Install ${prefix}:  /usr/local/icinga
                Lock file:  ${prefix}/var/icinga.lock
   Check result directory:  ${prefix}/var/spool/checkresults
           Init directory:  /etc/init.d
  Apache conf.d directory:  /etc/apache2/conf.d
             Mail program:  /usr/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):  /usr/sbin/traceroute
....
r-o-f:~/icinga-1.0# make all
....
*** Compile finished ***
....
r-o-f:~/icinga-1.0# make fullinstall

Mit make fullinstall wird das Hauptprogramm, CGIs, API, HTML Files, Init-Scripte (/etc/init.d/) installiert und die Berechtigungen für das External-Command-Verzeichnis gesetzt.
Unter /usr/local/icinga/etc wird eine Beispielkonfiguration angelegt. Zusätzlich wird unter /etc/apache2/conf.d/icinga.conf die Konfiguration für das Web-Interface plaziert. Danach muss der Webserver neu gestartet werden.

V. Web-User und Passwort definieren

r-o-f:~# htpasswd -c /usr/local/icinga/etc/htpasswd.users root-on-fire
New password:
Re-type new password:
Adding password for user root-on-fire

Mit dem -c Parameter legt htpasswd die htpasswd.users Datei neu an bzw. überschreibt ohne Nachfrage das alte File!
Weitere user können ganz einfach mit folgendem Befehl angelegt werden:

r-o-f:~# htpasswd /usr/local/icinga/etc/htpasswd.users another-user

VII. Nagios Plugins herunterladen, kompilieren und installieren

r-o-f:~# wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.14.tar.gz
r-o-f:~# tar xvzf nagios-plugins-1.4.14.tar.gz
r-o-f:~# cd ./nagios-plugins-1.4.14
r-o-f:~/nagios-plugins-1.4.14# ./configure --prefix=/usr/local/icinga --with-nagios-user=icinga
r-o-f:~/nagios-plugins-1.4.14# make
r-o-f:~/nagios-plugins-1.4.14# make install

VIII. Kontakt & Berechtigung definieren
Icinga regelt die Benutzerberechtigung wie Nagios über die Kontaktgruppen. Der Web-User muss in einer der definierten Kontaktgruppen sein. Sonst kann er sich zwar einloggen, wird aber nichts sehen.
Ein neuer Kontakt kann in der /usr/local/icinga/etc/objects/contacts.cfg definiert werden:

define contact{
        contact_name                    root-on-fire
        use                             generic-contact  
        alias                           ROOT ON FIRE
        email                           r-o-f@localhost
        }

Wenn bei dem Service bzw. Host definiert ist, dass eine Kontaktgruppe benachrichtigt werde soll, muss der Kontakt noch zu der entsprechenden Gruppe hinzugefügt werden. Das wird auch in der contacts.cfg definiert:

define contactgroup{
        contactgroup_name               admins
        alias                           Icinga Administrators
        members                         icingaadmin,root-on-fire
        }

Weitere Web-Berechtigungen werden in der /usr/local//icinga/etc/cgi.cfg definiert.

VII. Konfiguration überprüfen und Icinga starten
Mit den folgdenen Befehlen kann die Konfiguration vor dem Start bzw. Restart überprüft werden.
Der erste Befehl ist deutlich ausführlicher...

r-o-f:~# /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

oder

r-o-f:~# /etc/init.d/icinga checkconfig
Running configuration check... OK.

Wenn bei der Überprüfung keine Fehler gefunden werden kann Icinga gestartet werden:

r-o-f:~# /etc/init.d/icinga start
Starting icinga: done.

VIII. Screenshots

icinga01

icinga02

Quellen und weiterführende Links

Icinga Homepage: http://www.icinga.org/
Icinga Dokumentation: http://docs.icinga.org/
Deutsche Nagios & Icinga Community: http://www.nagios-portal.org
Nagios Homepage: http://nagios.org/
Nagios-Plugins: http://nagios.org/download/plugins

16Dez/090

Icinga 1.0 Core und Icinga Web 0.9.1 alpha veröffentlicht

icinga_logo4-300x109
Das Icinga Team hat heute die erste Stable Version 1.0 und Icinga Web 0.9.1 alpha freigegeben. Icinga ist ein aus der deutschen Nagios Community enstandener Nagios Fork. Auf der Homepage von Icinga findet man neben einem Demo System auch ein Zugang zur Demo des neuen Web Interface, welches bereits im alpha Status der Nagios Weboberfläche um Welten voraus ist.




   
Get Adobe Flash playerPlugin by wpburn.com wordpress themes