freebsd:monit
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
freebsd:monit [2011/09/02 09:37] – créée sheltem | freebsd:monit [2011/09/26 14:30] (Version actuelle) – sheltem | ||
---|---|---|---|
Ligne 13: | Ligne 13: | ||
On commence donc par copier le fichier d' | On commence donc par copier le fichier d' | ||
- | cp / | + | |
+ | On pour le fonctionnement de base de monit on édite les lignes suivantes : | ||
+ | |||
+ | |||
+ | set daemon | ||
+ | set logfile syslog facility log_daemon | ||
+ | set statefile / | ||
+ | set mailserver localhost | ||
+ | | ||
+ | set httpd port 2812 | ||
+ | allow md5 / | ||
+ | |||
+ | On génère un mot de passe : | ||
+ | |||
+ | htpasswd -b / | ||
+ | |||
+ | Cela crée un fichier .htpasswd à l' | ||
+ | |||
+ | Si on utilise un fichier existant, l' | ||
+ | |||
+ | Cette méthode permet de ne pas laisser un mot de passe en clair dans le fichier de configuration de monit. | ||
+ | ==== Exemples de choses à monitorer ==== | ||
+ | |||
+ | Pour le systèmes : | ||
+ | |||
+ | check system nom_de_la_machine | ||
+ | if loadavg (1min) > 15 then alert | ||
+ | if loadavg (5min) > 20 then alert | ||
+ | if memory usage > 75% then alert | ||
+ | if swap usage > 70% then alert | ||
+ | if cpu usage (user) > 90% then alert | ||
+ | if cpu usage (system) > 50% then alert | ||
+ | if cpu usage (wait) > 20% then alert | ||
+ | |||
+ | Pour apache : | ||
+ | |||
+ | check process httpd with pidfile / | ||
+ | start program = "/ | ||
+ | stop program | ||
+ | if cpu > 60% for 2 cycles then alert | ||
+ | if cpu > 80% for 5 cycles then restart | ||
+ | if totalmem > 200.0 MB for 5 cycles then restart | ||
+ | if children > 250 then restart | ||
+ | if loadavg(5min) greater than 10 for 8 cycles then stop | ||
+ | if failed host nom_du_site_a_monitorer port 80 protocol http | ||
+ | and request "/ | ||
+ | then restart | ||
+ | if 3 restarts within 5 cycles then timeout | ||
+ | group www | ||
+ | |||
+ | Pour Mysql : | ||
+ | |||
+ | check process mysqld with pidfile / | ||
+ | group mysql | ||
+ | start program = "/ | ||
+ | stop program = "/ | ||
+ | if failed host 127.0.0.1 port 3306 then restart | ||
+ | if 5 restarts within 5 cycles then timeout | ||
+ | |||
+ | Pour SSH : | ||
+ | |||
+ | check process sshd with pidfile / | ||
+ | start program | ||
+ | stop program | ||
+ | if failed port 22 protocol ssh then restart | ||
+ | if 5 restarts within 5 cycles then timeout | ||
+ | |||
+ | Pour un serveur Murmur : | ||
+ | |||
+ | check process murmur with pidfile / | ||
+ | start program | ||
+ | stop program | ||
+ | if 5 restarts within 5 cycles then timeout | ||
+ | |||
+ | ===== Traces ===== | ||
+ | |||
+ | Dans le fichier de configuration on indique à monit d' | ||
+ | |||
+ | daemon.info | ||
+ | | ||
+ | Et par conséquent, | ||
+ | |||
+ | / | ||
+ | | ||
+ | De cette manière, chaque fois que le fichier de log atteint 100Kb, il est compressé en bzip2 pour être sauvegardé avant d' | ||
+ | |||
+ | {{tag> |
freebsd/monit.1314956248.txt.gz · Dernière modification : 2011/09/02 09:37 de sheltem