Icinga

Installation Icinga web frontend from scratch

Install icinga-web standalone from scratch

  1. Prerequisites

    Based on the fact that you have a running mysql and php (with PEAR and CLI) environment and Icinga and IDOUtils are running as well you can continue with the second step. ianOtherwise:

    Ubuntu / Debian

     # apt-get install php5-cli php-pear php5-xmlrpc php5-xsl

    Fedora / RHEL / CentOS

     # yum install php-cli php-pear php-xmlrpc php-xsl

    OpenSuSE

    Please use yast to install the packages "php5-pear", "php5-xmlrpc" und "php5-xsl". The CLI is contained in the php5 package

    Take your clone from the icinga-web.git to get a fresh branch

     # git clone git://git.icinga.org/icinga-web.git
  2. The installation

     # tar xzvf icinga-web-(version).tar.gz
     # cd icinga-web

    Recently work has been started on setting up an installer for the new Icinga-web UI, use:

     # ./configure --help

    to see all configure options.

    Default the Icinga Webinterface will be installed to /usr/local/icinga-web by:

     # ./configure
     # make install
  3. PHP dependencies

    Test the php dependencies with:

     # make testdeps

    All required tests should pass successfully. Maybe you have to alter the php.ini for the framework.

    In case of the gpc_magic_quote setting, you have to disable both entries (apache and cli php.ini).

     # vi /etc/php5/apache/php.ini
       magic_quotes_gpc = off
    
     # vi /etc/php5/cli/php.ini
       magic_quotes_gpc = off
  4. Database installation

    Manual creation

    Create a database and a user you like. The user must have default data privileges like SELECT, UPDATE, INSERT, DELETE. Import the schemes etc/database/deploy/init.sql and etc/database/deploy/db-deploy.sql to your database. Thats all.

    Auto creation

    Create a database user with scheme and data privileges (CREATE, DROP, ALTER, INDEX). Go to the etc dir and copy the build.properties to a safe place (e.g. /tmp). Alter the database settings within the properties file. You can also set you database root user to create your scheme. Call the phing deploy task:

    # /usr/local/icinga-web/bin/phing -Dproperties=/usr/local/icinga-web/etc/build.properties db-initialize

    You have to manually create a database user to access your database. Add the default data privileges that icinga-web can work with the newly created database.

  5. Icinga-web settings

    Alter the config files: Edit /usr/local/icinga-web/app/config/databases.xml and set database credentials (block should begin at line 7, in this Example: DB-User: icinga_user, PW: password):

        <database name="appkit_default" class="AgaviDoctrineDatabase">
           <ae:parameter name="dsn">mysql://icinga_user:password@127.0.0.1:3306/icinga_web</ae:parameter>
           <ae:parameter name="username">icinga_user</ae:parameter>
           <ae:parameter name="password">password</ae:parameter>
           <ae:parameter name="charset">utf8</ae:parameter>
           <ae:parameter name="manager_attributes">
                
              <ae:parameter name="MODEL_LOADING">CONSERVATIVE</ae:parameter>
           </ae:parameter>
           <ae:parameter name="load_models">%de.icinga.appkit.doctrine_model_path%</ae:parameter>
        </database>

    Change the credentials for your database connection

    Edit /usr/local/icinga-web/app/config/icinga.xml and set database credentials to give access to ido-db (block should begin at line 163):

     <parameter name="IcingaData">
         <parameter name="class">IcingaData</parameter>
         <parameter name="api_file">%core.root_dir%/lib/icinga-api/IcingaApi.php</parameter>
         <parameter name="api_type">IcingaApi::CONNECTION_IDO</parameter>
         <parameter name="config_type">mysql</parameter>
         <parameter name="config_host">127.0.0.1</parameter>
    
         <parameter name="config_port">3306</parameter>
         <parameter name="config_database">icinga</parameter>
    
         <parameter name="config_user">your-ido-user</parameter>
         <parameter name="config_password">your-ido-pw</parameter>
    
         <parameter name="config_table_prefix">icinga_</parameter>
     </parameter>
    [Note] Note
    Please keep in mind that you have to install IDOUtils before (according to the “Icinga with IDOUtils Quickstart” )

    Go to the appkit.factories section and change the path and the credentials for the icinga-api.

     <!-- icinga-api data interface -->
                    <parameter name="IcingaData">
                            <parameter name="class">IcingaData</parameter>
                            <parameter name="file">%core.module_dir%/Web/lib/icinga/factory/IcingaData.class.php </parameter>
    
                             <parameter name="requiredClasses">
                                    <!-- NONE -->
                             </parameter>
    
                             <parameter name="api_file">%core.root_dir%/icinga-api/IcingaApi.php/<parameter>
                             <parameter name="api_type">IcingaApi::CONNECTION_IDO</parameter>
    
                             <parameter name="config_type">mysql</parameter>
                             <parameter name="config_host">127.0.0.1</parameter>
    
    
                             <parameter name="config_port">3306</parameter>
                             <parameter name="config_database">icinga</parameter>
    
                             <parameter name="config_user">your-ido-user</parameter>
                             <parameter name="config_password">your-ido-pw</parameter>
    
                             <parameter name="config_table_prefix">icinga_</parameter>
                    </parameter>
  6. Apache settings

    This should be prepared:

    * mod_rewrite enabled, maybe you have to create a link:

     # ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enable/rewrite.load

    Using OpenSuSE you have to edit the file "/etc/sysconfig/apache2". The module "rewrite" has to be appended to the line "APACHE_MODULES=...".

    * Any htaccess enabled alias settings

    Edit your .htaccess in /usr/local/icinga-web/pub :

    At line 14, change the RewriteBase direction to suite your needs:

     DirectoryIndex index.php
    
    Options -MultiViews -Indexes +FollowSymLinks
    Order allow,deny
    Allow from all
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        # This depends on your path
        # on independent hosts the base is '/'
        RewriteBase /icinga-web/
    
            # If the requested URL does not exist (it's likely an agavi route),
            # pass it as path info to index.php, the Agavi dispatch script.
            RewriteRule ^$ index.php?/ [QSA,L]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule (.*) index.php?/$1 [QSA,L]
    </IfModule>
    
    <IfModule mod_deflate.c>
            SetOutputFilter DEFLATE
    
            BrowserMatch ^Mozilla/4 gzip-only-text/html
            BrowserMatch ^Mozilla/4\.0[678] no-gzip
    
            BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
            BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
    
            Header append Vary User-Agent env=!dont-vary
    </IfModule>
    
    <IfDefine APACHE2>
            AcceptPathInf  On
    </IfDefine>
    
    #<IfModule mod_auth_basic.c>
    #       AuthType Basic
    #       AuthName "My http basic auth realm"
    #       AuthUserFile /path/to/my/htusers
    #       require valid-user
    #</IfModule>

    Go to the webservers configuration directory and create a new alias (maybe in /etc/apache2/conf.d/icinga.conf) :

    # vi /etc/apache2/conf.d/icinga.conf
      Alias /icinga-web /usr/local/icinga-web/pub
      <directory /usr/local/icinga-web/pub>
            AllowOverride All
      </directory>

    Clear cache:

    # rm /usr/local/icinga-web/app/cache/config/*.php

    Restart your Webserver:

    # service apache2 restart
  7. Try

    Please ensure mysql, apache, idoutils and icinga are running!

    Go to the webpath and try if the webinterface starts without exceptions (database connections web and api). You can login with user 'root' and password 'password'