MONITORING - Configuration du monitoring RPS : Différence entre versions
De PedroWiki
(Nouvelle page : = Introduction = Article "bloc-note" sur la mise en place du monitoring de rps.pedrono.fr = Objectifs = Monitoring de services: * monitorer le service "ssh" * monitorer le service...) |
m (→Monitorer le RPS) |
||
(5 révisions intermédiaires par le même utilisateur non affichées) | |||
Ligne 16 : | Ligne 16 : | ||
* monitorer les utilisateurs connectés | * monitorer les utilisateurs connectés | ||
* monitorer la charge système | * monitorer la charge système | ||
+ | * monitorer le serveur SQL, inaccessible de l'extérieur | ||
= Configuration = | = Configuration = | ||
Ligne 22 : | Ligne 23 : | ||
[http://nagios.sourceforge.net/docs/3_0/monitoring-linux.html Monitorer des hôtes Linux] | [http://nagios.sourceforge.net/docs/3_0/monitoring-linux.html Monitorer des hôtes Linux] | ||
+ | |||
+ | == Monitorer le RPS == | ||
+ | |||
+ | Sur Corni, édition de ''/usr/local/nagios/etc/nagios.cfg'': | ||
+ | ... | ||
+ | # Definitions for monitoring the RPS server | ||
+ | cfg_file=/usr/local/nagios/etc/objects/rps.cfg | ||
+ | ... | ||
+ | |||
+ | Sur Corni, création d'un fichier de config pour serveur Linux: | ||
+ | jules@corni:/usr/local/nagios/etc$ sudo cp objects/localhost.cfg objects/rps.cfg | ||
+ | |||
+ | Adaptation de la configuration, déclaration du serveur, édition de ''/usr/local/nagios/etc/objects/rps.cfg'': | ||
+ | define host{ | ||
+ | use linux-server | ||
+ | host_name '''rps''' | ||
+ | alias rps.pedrono.fr | ||
+ | address 87.98.167.215 | ||
+ | } | ||
+ | |||
+ | define hostgroup{ | ||
+ | hostgroup_name '''serveur_prod''' | ||
+ | alias Serveurs de production | ||
+ | members '''rps''' | ||
+ | } | ||
+ | |||
+ | Adaptation de la configuration, déclaration des services, édition de ''/usr/local/nagios/etc/objects/rps.cfg'': | ||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''PING''' | ||
+ | check_command check_ping!100.0,20%!500.0,60% | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''Check du slash''' | ||
+ | check_command check_nrpe!check_slash | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''Check du home''' | ||
+ | check_command check_nrpe!check_home | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''Utilisateurs Connectés''' | ||
+ | check_command check_nrpe!check_users | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''Nombre de processus''' | ||
+ | check_command check_nrpe!check_total_procs | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''Charge systeme''' | ||
+ | check_command check_nrpe!check_load | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''Postfix queue''' | ||
+ | check_command check_nrpe!check_mailq | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''MYSQL''' | ||
+ | check_command check_nrpe!check_mysql | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''SSH''' | ||
+ | check_command check_ssh | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''HTTP''' | ||
+ | check_command check_http | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name rps | ||
+ | service_description '''FTP''' | ||
+ | check_command check_ftp | ||
+ | } | ||
+ | |||
+ | Définition de la commande "check_nrpe", édition de ''/usr/local/nagios/etc/objects/commands.cfg'': | ||
+ | # 'check_nrpe' command definition | ||
+ | define command{ | ||
+ | command_name check_nrpe | ||
+ | command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ | ||
+ | } | ||
+ | |||
+ | Vérification de la validité de la configuration: | ||
+ | jules@corni:/usr/local/nagios/etc$ sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg | ||
+ | |||
+ | Nagios 3.0.6 | ||
+ | Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org) | ||
+ | Last Modified: 12-01-2008 | ||
+ | License: GPL | ||
+ | |||
+ | Reading configuration data... | ||
+ | |||
+ | Running pre-flight check on configuration data... | ||
+ | |||
+ | Checking services... | ||
+ | Checked 18 services. | ||
+ | Checking hosts... | ||
+ | Checked 2 hosts. | ||
+ | Checking host groups... | ||
+ | Checked 2 host groups. | ||
+ | Checking service groups... | ||
+ | Checked 0 service groups. | ||
+ | Checking contacts... | ||
+ | Checked 2 contacts. | ||
+ | Checking contact groups... | ||
+ | Checked 1 contact groups. | ||
+ | Checking service escalations... | ||
+ | Checked 0 service escalations. | ||
+ | Checking service dependencies... | ||
+ | Checked 0 service dependencies. | ||
+ | Checking host escalations... | ||
+ | Checked 0 host escalations. | ||
+ | Checking host dependencies... | ||
+ | Checked 0 host dependencies. | ||
+ | Checking commands... | ||
+ | Checked 25 commands. | ||
+ | Checking time periods... | ||
+ | Checked 5 time periods. | ||
+ | Checking for circular paths between hosts... | ||
+ | Checking for circular host and service dependencies... | ||
+ | Checking global event handlers... | ||
+ | Checking obsessive compulsive processor commands... | ||
+ | Checking misc settings... | ||
+ | |||
+ | '''Total Warnings: 0''' | ||
+ | '''Total Errors: 0''' '''OK''' | ||
+ | |||
+ | Things look okay - No serious problems were detected during the pre-flight check | ||
+ | jules@corni:/usr/local/nagios/etc$ | ||
+ | |||
+ | Prise en compte de la configuration: | ||
+ | jules@corni:/usr/local/nagios/etc$ sudo /etc/init.d/nagios reload | ||
+ | |||
+ | |||
[[Category:Monitoring]] | [[Category:Monitoring]] | ||
[[Category:Securite]] | [[Category:Securite]] | ||
[[Category:Howto]] | [[Category:Howto]] |
Version actuelle datée du 22 mars 2009 à 17:47
Introduction
Article "bloc-note" sur la mise en place du monitoring de rps.pedrono.fr
Objectifs
Monitoring de services:
- monitorer le service "ssh"
- monitorer le service "http"
- monitorer le service "ftp"
Monitoring NRPE:
- monitorer la queue de mail (détection d'utilisation frauduleuse du smtp)
- monitorer le remplissage de /
- monitorer le remplissage de /home (sites web)
- monitorer les utilisateurs connectés
- monitorer la charge système
- monitorer le serveur SQL, inaccessible de l'extérieur
Configuration
Référence documentaire
Monitorer le RPS
Sur Corni, édition de /usr/local/nagios/etc/nagios.cfg:
... # Definitions for monitoring the RPS server cfg_file=/usr/local/nagios/etc/objects/rps.cfg ...
Sur Corni, création d'un fichier de config pour serveur Linux:
jules@corni:/usr/local/nagios/etc$ sudo cp objects/localhost.cfg objects/rps.cfg
Adaptation de la configuration, déclaration du serveur, édition de /usr/local/nagios/etc/objects/rps.cfg:
define host{ use linux-server host_name rps alias rps.pedrono.fr address 87.98.167.215 }
define hostgroup{ hostgroup_name serveur_prod alias Serveurs de production members rps }
Adaptation de la configuration, déclaration des services, édition de /usr/local/nagios/etc/objects/rps.cfg:
define service{ use generic-service host_name rps service_description PING check_command check_ping!100.0,20%!500.0,60% }
define service{ use generic-service host_name rps service_description Check du slash check_command check_nrpe!check_slash }
define service{ use generic-service host_name rps service_description Check du home check_command check_nrpe!check_home }
define service{ use generic-service host_name rps service_description Utilisateurs Connectés check_command check_nrpe!check_users }
define service{ use generic-service host_name rps service_description Nombre de processus check_command check_nrpe!check_total_procs }
define service{ use generic-service host_name rps service_description Charge systeme check_command check_nrpe!check_load }
define service{ use generic-service host_name rps service_description Postfix queue check_command check_nrpe!check_mailq }
define service{ use generic-service host_name rps service_description MYSQL check_command check_nrpe!check_mysql }
define service{ use generic-service host_name rps service_description SSH check_command check_ssh }
define service{ use generic-service host_name rps service_description HTTP check_command check_http }
define service{ use generic-service host_name rps service_description FTP check_command check_ftp }
Définition de la commande "check_nrpe", édition de /usr/local/nagios/etc/objects/commands.cfg:
# 'check_nrpe' command definition define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
Vérification de la validité de la configuration:
jules@corni:/usr/local/nagios/etc$ sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg Nagios 3.0.6 Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org) Last Modified: 12-01-2008 License: GPL Reading configuration data... Running pre-flight check on configuration data... Checking services... Checked 18 services. Checking hosts... Checked 2 hosts. Checking host groups... Checked 2 host groups. Checking service groups... Checked 0 service groups. Checking contacts... Checked 2 contacts. Checking contact groups... Checked 1 contact groups. Checking service escalations... Checked 0 service escalations. Checking service dependencies... Checked 0 service dependencies. Checking host escalations... Checked 0 host escalations. Checking host dependencies... Checked 0 host dependencies. Checking commands... Checked 25 commands. Checking time periods... Checked 5 time periods. Checking for circular paths between hosts... Checking for circular host and service dependencies... Checking global event handlers... Checking obsessive compulsive processor commands... Checking misc settings... Total Warnings: 0 Total Errors: 0 OK Things look okay - No serious problems were detected during the pre-flight check jules@corni:/usr/local/nagios/etc$
Prise en compte de la configuration:
jules@corni:/usr/local/nagios/etc$ sudo /etc/init.d/nagios reload