Outils personnels

Installation de Shinken sur une Debian : Différence entre versions

De wikiGite

Ligne 180 : Ligne 180 :
  
 
  Editer thruk_local.conf
 
  Editer thruk_local.conf
 +
 +
----
 +
 +
libcatalyst-perl libcatalyst-engine-apache-perl libcatalyst-model-cdbi-perl libcatalyst-modules-extra-perl libcatalyst-modules-perl libcatalyst-view-tt-perl libhtml-prototype-perl
 +
  
 
A virer :
 
A virer :

Version du 24 mai 2011 à 13:11

Source : Nicolargo

La version 0.4 du script va installer:

  • Shinken 0.6
  • Thruk 1.0.2

La procédure pour installer ou mettre à jour votre serveur de supervision Shinken est toujours la même:

cd ~
rm -f shinkenautoinstall-debian.sh
wget http://svn.nicolargo.com/shinkenautoinstall/trunk/shinkenautoinstall-debian.sh
chmod a+x shinkenautoinstall-debian.sh
sudo ./shinkenautoinstall-debian.sh

Si tout se passe comme prévu, le script devrait afficher:

----------------------------------------------------
Installation is finished
----------------------------------------------------
Backup configuration file : /tmp/shinken-backup-20110513073545.tgz
Configuration file folder : /etc/shinken
Log file : /var/lib/shinken/nagios.log
Shinken startup script : /etc/init.d/shinken
Thruk startup script : /etc/init.d/thruk
Thruk web interface URL : http://sam:3000

Dans certain cas, notamment lors d'une mise à jour, il faut ensuite relancer Shinken:

sudo /etc/init.d/shinken restart

Pour remonter les éventuels bugs / nouvelles fonctions, merci d'utiliser le site officiel du script qui se trouve sur GitHub à l'adresse suivante: https://github.com/nicolargo/shinkenautoinstall.


Manuel :

If you follow these instructions, here's what you'll end up with:

Shinken and the plugins will be installed underneath

”/usr/local/shinken”

Required Packages

Make sure you've installed the following packages on your Ubuntu installation before continuing.

Python >= 2.4
Pyro (Python module for distributed objects)
Git (If you want the lastest code)
python-setuptools

On a debian based system (like Ubuntu) you can use apt-get to install these packages by running the following commands:

sudo apt-get install python pyro git-core python-setuptools

Create Account Information

Become the root user.

sudo su -

Create a new shinken user account and give it a password.

/usr/sbin/useradd -m shinken
passwd shinken

On Ubuntu server edition (9.10 and possible newer versions), you will need to also add a shinken group (it's not created by default). You should be able to skip this step on desktop editions of Ubuntu.

/usr/sbin/groupadd shinken
/usr/sbin/usermod -G shinken shinken

Add the apache user to this group to allow external commands to be send from the web interface.

/usr/sbin/usermod -G shinken www-data

Download Shinken and the Plugins

Create a directory for storing the downloads.

mkdir ~/downloads
cd ~/downloads

Download the source code of Shinken and the Shinken plugins (visit http://www.nagios.org/download/ for links to the latest versions of the plugins). At the time of writing, the latest versions plugins were 1.4.13.

git clone git://shinken.git.sourceforge.net/gitroot/shinken/shinken

Install Shinken (repasser en utilisateur normal)

cd shinken
sudo python setup.py install --install-scripts=/usr/bin

Don't start Shinken yet - there's still more that needs to be done… Customize Configuration

Sample configuration files have now been installed in the ”/etc/shinken/” directory. These sample files should work fine for getting started with Shinken. You'll need to make just one change before you proceed… Install the Nagios Plugins to use with Shinken

You can download plugins from source, but your debian-like administrator will just will you :

sudo apt-get install nagios-plugins

Start Shinken

Configure Shinken to automatically start when the system boots.

sudo ln -s /etc/init.d/shinken-scheduler /etc/rcS.d/S98shinken-scheduler
sudo ln -s /etc/init.d/shinken-poller /etc/rcS.d/S98shinken-poller
sudo ln -s /etc/init.d/shinken-reactionner /etc/rcS.d/S98shinken-reactionner
sudo ln -s /etc/init.d/shinken-broker /etc/rcS.d/S98shinken-broker
sudo ln -s /etc/init.d/shinken-arbiter /etc/rcS.d/S98shinken-arbiter

Verify the sample Shinken configuration files.

/usr/bin/shinken-arbiter -v -c /etc/shinken/nagios.cfg -c /etc/shinken/shinken-specific.cfg

If there are no errors, start Shinken.

sudo /etc/init.d/shinken-scheduler start
sudo /etc/init.d/shinken-poller start
sudo /etc/init.d/shinken-broker start
sudo /etc/init.d/shinken-reactionner start
sudo /etc/init.d/shinken-arbiter start

Thruk FastCGI

créer un répertoire thruk dans /opt

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
apt-get install libapache2-mod-fcgid libfile-copy-recursive-perl libmodule-install-perl apache2 libgd2-xpm-dev

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

Lancement script Fastcgi :

./script/thruk_fastcgi.pl -n 5 -l /tmp/thruk_fastcgi.socket -p /tmp/thruk_fastcgi.pid

Paramétrage du démarrage automatique :

cp ./script/thruk_fastcgi_server.sh /etc/init.d/thruk_fastcgi_server
vi /etc/init.d/thruk_fastcgi_server
sudo chown root: /etc/init.d/thruk_fastcgi_server

Modifier le execuser par shinken (thruk par défaut) et le execdir

attention aux droits sur /tmp

Apache :

/etc/apache2/sites-available
vi thruk

mettre le contenu du fichier

Thruk Apache Configuration

ports.conf

thruk 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

git clone http://github.com/sni/Thruk.git
cd Thruk
perl Makefile.PL && make
cp thruk.conf thruk_local.conf
htpasswd -c /opt/thruk/htpasswd.users admin

chown -R shinken:shinken /opt/thruk
Editer thruk_local.conf

libcatalyst-perl libcatalyst-engine-apache-perl libcatalyst-model-cdbi-perl libcatalyst-modules-extra-perl libcatalyst-modules-perl libcatalyst-view-tt-perl libhtml-prototype-perl


A virer :

a2enmod suexec
SuexecUserGroup shinken shinken
apt-get install apache2-suexec
/usr/lib/apache2/suexec -V