Outils personnels

Installation FastCGI de l'interface Thruk sur une Debian : Différence entre versions

De wikiGite

 
(7 révisions intermédiaires par un autre utilisateur non affichées)
Ligne 1 : Ligne 1 :
Thruk Installation FastCGI avec le module "mod_fcgid"
+
Thruk : Installation FastCGI avec le module "mod_fcgid"
  
Pré-Requis :
+
Installation des Pré-Requis :
  apt-get install libapache2-mod-fcgid libfile-copy-recursive-perl libmodule-install-perl apache2 libgd2-xpm-dev
+
apt-get install apache2
 +
  apt-get install libapache2-mod-fcgid libfile-copy-recursive-perl libmodule-install-perl libgd2-xpm-dev liblog-log4perl-perl
 
   
 
   
 +
Téléchargement de la dernière version dans le répertoire /opt :
 +
mkdir thruk
 
  wget http://www.thruk.org/files/Thruk-1.0.4-x86_64-linux-gnu-thread-multi-5.10.0.tar.gz
 
  wget http://www.thruk.org/files/Thruk-1.0.4-x86_64-linux-gnu-thread-multi-5.10.0.tar.gz
 
  tar -xzf Thruk-1.0.4-x86_64-linux-gnu-thread-multi-5.10.0.tar.gz
 
  tar -xzf Thruk-1.0.4-x86_64-linux-gnu-thread-multi-5.10.0.tar.gz
 
+
mv Thruk-1.0.4 Thruk
Apache :  
+
cd Thruk
 
+
perl Makefile.PL && make
 +
 +
Configuration d'Apache :  
 
  /etc/apache2/sites-available
 
  /etc/apache2/sites-available
 
  vi thruk
 
  vi thruk
mettre le contenu du fichier
 
  
[[Thruk Apache Configuration]]
+
Contenu du fichier Thruk :
 +
#LoadModule fcgid_module /usr/lib/apache2/modules/mod_fcgid.so
 +
<VirtualHost *:3000>
 +
    ServerName  hostname
 +
    DocumentRoot /opt/thruk/root/
 +
    CustomLog    /opt/thruk/logs/access.log combined
 +
    ErrorLog    /opt/thruk/logs/error.log
 +
    <Directory /opt/thruk/root/>
 +
        Options FollowSymLinks
 +
        AllowOverride All
 +
        order allow,deny
 +
        allow from all
 +
    </Directory>
 +
    AliasMatch /thruk/(.*\.cgi|.*\.html)  /opt/thruk/script/thruk_fastcgi.pl/thruk/$1
 +
    <Location /thruk>
 +
        Options ExecCGI
 +
        Order allow,deny
 +
        Allow from all
 +
        AuthName "Monitoring Access"
 +
        AuthType Basic
 +
        AuthUserFile /opt/thruk/htpasswd.users
 +
        Require valid-user
 +
    </Location>
 +
    <IfModule mod_fcgid.c>
 +
      AddHandler fcgid-script .pl
 +
      MaxRequestsPerProcess 100
 +
    </IfModule>
 +
  </VirtualHost>
  
 
ports.conf
 
ports.conf
 +
NameVirtualHost *:3000
 +
Listen 3000
  
thruk
 
Supprimer l'ancien lien symbolique de la configuration d'origine
 
  
sudo a2dissite default
+
Supprimer l'ancien lien symbolique de la configuration d'origine :
 +
sudo a2dissite default
  
 
Il faut maintenant activer le vhost. Pour cela il faut créer un lien symbolique du fichier de sites-available/ vers sites-enabled/.
 
Il faut maintenant activer le vhost. Pour cela il faut créer un lien symbolique du fichier de sites-available/ vers sites-enabled/.
 
En utilisant:
 
En utilisant:
 
 
  sudo a2ensite thruk
 
  sudo a2ensite thruk
  
/etc/init.d/apache2 restart / reload
+
/etc/init.d/apache2 restart / reload
 
 
git clone http://github.com/sni/Thruk.git
 
cd Thruk
 
perl Makefile.PL && make
 
  
 
  cp thruk.conf thruk_local.conf
 
  cp thruk.conf thruk_local.conf
  
 
Editer thruk_local.conf
 
Editer thruk_local.conf
 +
 +
Contenu :
 +
<Component Thruk::Backend>
 +
    <peer>
 +
        name  = Shinken
 +
        type  = livestatus
 +
        <options>
 +
            peer    = 127.0.0.1:50000
 +
        </options>
 +
    </peer>
 +
</Component>
  
 
  htpasswd -c /opt/thruk/htpasswd.users admin
 
  htpasswd -c /opt/thruk/htpasswd.users admin
Ligne 41 : Ligne 79 :
 
  chown -R shinken:shinken /opt/thruk
 
  chown -R shinken:shinken /opt/thruk
  
Editer cgi.cfg
+
Editer cgi.cfg pour désactiver l'authentification :
désactiver l'authentification
+
use_authentication=0
  
 
Attention aux droits sur /tmp, pour être tranquille :
 
Attention aux droits sur /tmp, pour être tranquille :

Version actuelle datée du 3 juin 2011 à 14:05

Thruk : Installation FastCGI avec le module "mod_fcgid"

Installation des Pré-Requis :

apt-get install apache2
apt-get install libapache2-mod-fcgid libfile-copy-recursive-perl libmodule-install-perl libgd2-xpm-dev liblog-log4perl-perl

Téléchargement de la dernière version dans le répertoire /opt :

mkdir thruk
wget http://www.thruk.org/files/Thruk-1.0.4-x86_64-linux-gnu-thread-multi-5.10.0.tar.gz
tar -xzf Thruk-1.0.4-x86_64-linux-gnu-thread-multi-5.10.0.tar.gz
mv Thruk-1.0.4 Thruk
cd Thruk
perl Makefile.PL && make

Configuration d'Apache :

/etc/apache2/sites-available
vi thruk

Contenu du fichier Thruk :

#LoadModule fcgid_module /usr/lib/apache2/modules/mod_fcgid.so
<VirtualHost *:3000>
    ServerName   hostname
    DocumentRoot /opt/thruk/root/
    CustomLog    /opt/thruk/logs/access.log combined
    ErrorLog     /opt/thruk/logs/error.log
    <Directory /opt/thruk/root/>
        Options FollowSymLinks
        AllowOverride All
        order allow,deny
        allow from all
    </Directory>
    AliasMatch /thruk/(.*\.cgi|.*\.html)  /opt/thruk/script/thruk_fastcgi.pl/thruk/$1
    <Location /thruk>
        Options ExecCGI
        Order allow,deny
        Allow from all
        AuthName "Monitoring Access"
        AuthType Basic
        AuthUserFile /opt/thruk/htpasswd.users
        Require valid-user
    </Location>
    <IfModule mod_fcgid.c>
      AddHandler fcgid-script .pl
      MaxRequestsPerProcess 100
    </IfModule>
 </VirtualHost>

ports.conf

NameVirtualHost *:3000
Listen 3000


Supprimer l'ancien lien symbolique de la configuration d'origine :

sudo a2dissite default

Il faut maintenant activer le vhost. Pour cela il faut créer un lien symbolique du fichier de sites-available/ vers sites-enabled/. En utilisant:

sudo a2ensite thruk
/etc/init.d/apache2 restart / reload
cp thruk.conf thruk_local.conf

Editer thruk_local.conf

Contenu :

<Component Thruk::Backend> 
    <peer>
        name   = Shinken
        type   = livestatus
        <options>
            peer    = 127.0.0.1:50000
       </options>
    </peer>
</Component>
htpasswd -c /opt/thruk/htpasswd.users admin

chown -R shinken:shinken /opt/thruk

Editer cgi.cfg pour désactiver l'authentification :

use_authentication=0

Attention aux droits sur /tmp, pour être tranquille :

chmod -R 777 /tmp

Attention :

use this apache example configuration:
replace /home/thruk/Thruk with your installation path
replace your-web-host.local with your hostname
create a /home/thruk/Thruk/htpasswd.users with htpasswd2
make sure the /home/thruk/Thruk/logs/ directory exists