######Fichier de conf simple pour ce petit outil de monitoring:
##Start Monit in the background (run as a daemon):
set daemon 120 # check services at 2-minute intervals
set logfile /var/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state
set mailserver localhost
set eventqueue
basedir /var/lib/monit/events
slots 100
## Adresse mail pour toutes les alertes
set alert [email protected]
## Interface web
set httpd
port 2812
allow localhost
allow 192.168.XX.0/255.255.255.0 #sous-reseau ayant acces à l'interface
## Services locaux
check system machine.domaine.pif
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 75% then alert
if swap usage > 25% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
## Hôtes
check host HOTE1 with address 192.168.XX.X
if failed icmp type echo count 3 with timeout 10 seconds then alert
#3 ping envoyes - tous doivent depasser les 10 secs de timeout pour declencher l'alerte
if failed port 3306 protocol mysql then alert
if failed port 80 protocol http then alert
check host EXTRANET with address extranet.domaine.pif
if failed icmp type echo count 3 with timeout 10 seconds then alert
if failed port 3306 protocol mysql then alert
if failed port 80 protocol http then alert
if failed port 8080 protocol http then alert
alert [email protected] #autres personnes à alerter