La gestion d'un parc de serveur est un travail de chaque instant. Un bon administrateur système doit savoir à tout moment l'état des différentes machines et des différents services. Un autre aspect clé est que l'administrateur ne peut pas se permettre de passer son temps devant un tableau avec des voyants verts en attendant qu'un voyant passe au rouge pour agir. Son temps est occupé à d'autres tâches et il ne peut donc pas surveiller le tableau de statut en permanence.
L'examen journalier des logs systèmes est un bon début. Cependant, si un problème survient, on s'en rend compte seulement le lendemain. Ce qui peut être très (trop ?) tard.
Pour se simplifier le travail, nous allons utiliser un moniteur de supervision. Le but d'un tel programme est de surveiller les services et les machines se trouvant sous notre responsabilité. Si un problème survient, le moniteur de supervision nous prévient (email, SMS, etc.).
Le moniteur de supervision que nous allons envisager est Zabbix.
date.timezone = Europe/Paris
Avant tout, créez la base de données « zabbix » sous MySQL (remplacez [user] par le login utilisé pour vous connecter à mysql) :
mysql -u[user] -p mysql> create database zabbix; mysql> quit
Créez une base postGRES
$ createdb zabbix
creating database zabbix: already exists.
Puis, installer les paquets :
Il est possible de ne rien installer sur les pcs clients. Cependant, la liste des informations disponibles sera plus limitée. L'installation du client Zabbix sur les PCs permet de donner à Zabbix toute sa puissance.
Installez le paquet zabbix-agent et éditez le fichier /etc/zabbix/zabbix_agentd.conf pour y indiquer l'adresse IP dans la variable "Serveur" .
ZabbixW32.exe install
ZabbixW32.exe start
Pour accéder à Zabbix, lancez votre navigateur préféré et rendez-vous à l'adresse :
Par défaut, le login est « Admin » et le mot de passe est vide.
Janvier 2012 / Ubuntu 11.10 : Zabbix-serveur MySQL version 1.8.10 : Par défaut le login est Admin et le mot de passe est zabbix (By Ayitita)
Décembre 2009 / Ubuntu 9.10, avec Synaptic : Zabbix-serveur MySQL version 1.6.4 (en retard ? la 1.8 est dispo) : se connecter avec Admin comme login et zabbix comme mot de passe.
sudo chmod +r /etc/zabbix/dbconfig.php
sudo grep DBPassword /etc/zabbix/zabbix_server.conf
Le résultat va être le mot de passe généré par zabbix
sudo nano /etc/zabbix/dbconfig.php
Là dans le champ "$DB["PASSWORD"] = ", vous remplacez le mot de passe contenu par celui obtenu lors de la commande précédente.
sudo apt-get install libsnmp9-dev libmysqlclient15-dev 1 - Make the zabbix user and group: sudo adduser zabbix enter in new password confirm use the remaining defaults. Add zabbix to the admin group: sudo adduser zabbix admin 2 - Download and Untar the sources: su - zabbix récupration des sources sur http://www.zabbix.com/download.php tar zxvpf zabbix-1.4.tar.gz 3 - Create a zabbix database and populate it: mysql -u root -p create database zabbix; quit; mysql -u root -p zabbix < /home/zabbix/zabbix-1.4/create/schema/mysql.sql mysql -u root -p zabbix < /home/zabbix/zabbix-1.4/create/data/data.sql 4 - Configure, compile and install the server: cd zabbix-1.4/ ./configure --prefix=/usr --with-mysql --with-net-snmp \ --enable-server --enable-agent && make sudo make install 5 - Prepare the rest of the system: sudo nano /etc/services Add at the end: zabbix_agent 10050/tcp # Zabbix ports zabbix_trap 10051/tcp Save and exit. sudo mkdir /etc/zabbix sudo chown -R zabbix.zabbix /etc/zabbix/ cp misc/conf/zabbix_* /etc/zabbix/ Edit /etc/zabbix/zabbix_agentd.conf: nano /etc/zabbix/zabbix_agentd.conf Make sure that the Server parameter points to the server address, for the agent that runs on the server it is like this: Server=127.0.0.1 Edit /etc/zabbix/zabbix_server.conf: nano /etc/zabbix/zabbix_server.conf For small sites this default file will do, however if you are into tweaking your config for your 10+ hosts site, this is the place. Change this: # Database password # Comment this line if no password used DBPassword=Secret Start the server : zabbix_server Start the client: zabbix_agentd & 6 - Configure web interface mkdir /home/zabbix/public_html cp -R frontends/php/* /home/zabbix/public_html/ Edit /etc/apache2/sites-enabled/000-default: sudo nano /etc/apache2/sites-enabled/000-default Work into file: Alias /zabbix/ /home/zabbix/public_html/ <Directory /home/zabbix/public_html> AllowOverride FileInfo AuthConfig Limit Indexes Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec <Limit GET POST OPTIONS PROPFIND> Order allow,deny Allow from all </Limit> <LimitExcept GET POST OPTIONS PROPFIND> Order deny,allow Deny from all </LimitExcept> </Directory> Save and exit. Make php.ini adjustments: sudo nano /etc/php5/apache2/php.ini Change the following values: max_execution_time = 300 ; Maximum execution time of each script, in seconds date.timezone = America/Kentucky/Louisville (use this url to find your correct timezone format: http://us3.php.net/manual/en/timezones.php ) Restart Apache: sudo /etc/init.d/apache2 restart Now point your browser to: http://<servername or ip>/zabbix/ 1. Introduction read and click Next 2. License Agreement Read, check 'I Agree', click Next 3. Check of Pre-Requisites Fix any problems, click retry. Click Next when all pre-requisites are OK. 4. Configure DB Connection Enter appropriate settings and click Test Connection. Click Next when OK. 5. Pre-Installation Summary Verify installation settings, click Next. 6. Install Click Save Configuration file and save to machine. Copy zabbix.conf.php to /home/zabbix/public_html/conf/zabbix.conf.php One way to do this from a desktop machine (requires ssh installed): scp zabbix.conf.php zabbix@<serverip>:/home/zabbix/public_html/conf/ Click Retry and click Next when OK. 7. Finish Click Finish to complete installation. Your New Zabbix install will now be shown. Log in with username: Admin No Password First go to the tab Configuration and then Hosts. Now create a host-group, see that you can give it some templates, e.g: Application.MySQL, Host.SNMP, Host.Standalone, Host.Unix. Then some hosts: Select your host-group and use Link with Template Host.Unix Now a lot of triggers are imported and the game begins. Go to the monitoring tab and watch the latest values roll in. For specifics on configuration, please refer to the Zabbix user manual. www.zabbix.com