Caution this is not a stable release, do not use on productive systems

the clean and proper way to install Thruk is to create a new local user and install the missing perl modules with local::lib.

Requirements

In order to install/use the Thruk Monitoring Webinterface for Nagios/Icinga you will need the following:

Create New User

refer to your systems manual on howto add new user. This guide uses the following:

  user:  thruk
  group: thruk

Thruk Monitoring Webinterface

Important all following steps should be done by the thruk user.

Install local::lib

Follow the steps on http://search.cpan.org/perldoc?local::lib#The_bootstrapping_technique

quick guide:

  %> su - thruk
  %> wget http://search.cpan.org/CPAN/authors/id/A/AP/APEIRON/local-lib-1.004009.tar.gz
  %> tar zxf local-lib-1.004009.tar.gz
  %> cd local-lib-1.004009
  %> perl Makefile.PL --bootstrap && make install
Tip
proxy configuration

if you need a proxy configuration, you should answer <no> at this question:

Would you like me to configure as much as possible automatically? [yes]

then add the following line to the thruk users .profile or .bashrc

eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)

logout and login again and verify that your perl env looks like this:

 %> env | grep perl
 PERL5LIB=/home/thruk/perl5/lib/perl5:/home/thruk/perl5/lib/perl5/x86_64-linux-gnu-thread-multi
 MODULEBUILDRC=/home/thruk/perl5/.modulebuildrc
 PATH=/home/thruk/perl5/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
 PERL_MM_OPT=INSTALL_BASE=/home/thruk/perl5

Install Module::Install

  perl -MCPAN -e "install Module::Install::Catalyst"

Git Clone Thruk

    git clone http://github.com/sni/Thruk.git
    cd Thruk
    perl Makefile.PL

press <enter> here:

  ==> Auto-install the 35 mandatory module(s) from CPAN? [y]

then run make

    make

This may take a while, as there are probably several modules missing.

Press <y> at this questions:

  Do you want to build the XS Stash module? [y]
  Do you want to use the XS Stash by default? [y]

run perl Makefile.PL again to see if all dependecies are now installed properly.

    perl Makefile.PL

Install / Patch Livestatus

Basically this script checks out the livestatus source with git and applies the needed patches.

    %> contrib/livestatus/patches/create_patched_livestatus_source_dir.sh
    %> cd /tmp/livestatus && ./build.sh && ./configure && make && cd -

You can then add this to your nagios/icinga.cfg

 broker_module=/tmp/livestatus/src/livestatus.o /tmp/live.sock

Configuration

edit "thruk.conf" and adjust the livestatus settings to your needs.

Test

verify installation with the packaged perl test

    make test

Start Server

After running these steps successfully, you should be able to test your installation:

    ./script/thruk_server.pl

Open your browser and open http://<your_host>:3000

FastCGI Server

start your fcgi server:

    %>./script/thruk_fastcgi.pl -n 5 \
                -l /tmp/thruk.socket \
                -p /tmp/thruk.pid

Apache Configuration

use this apache example configuration:

<VirtualHost *:80>
    ServerName   your-host.local

    DocumentRoot /home/thruk/Thruk/root/
    CustomLog    /home/thruk/Thruk/logs/access.log combined
    ErrorLog     /home/thruk/Thruk/logs/error.log

    <Directory />
        order deny,allow
        deny from all
    </Directory>

    <Directory /home/thruk/Thruk/root/>
        order allow,deny
        allow from all
    </Directory>

    # authorization
    <Location "/">
        AuthName "Monitoring Access"
        AuthType Basic
        AuthUserFile /home/thruk/Thruk/htpasswd.users
        Order Allow,Deny
        Allow from all
        require valid-user
    </Location>

    # Load fastcgi module unless already loaded
    LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so

    # fastcgi configuration
    FastCGIExternalServer /tmp/thruk.fcgi -socket /tmp/thruk.socket

    # Load rewrite module unless already loaded
    LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

    # rewrite configuration
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^/(.*)$ /tmp/thruk.fcgi/$1 [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
</VirtualHost>