# Configuración de monit

- Dirección: https://freemem.space/configuracion-de-monit/
- Publicada: 22 de junio de 2006
- Temas: Administración de sistemas
- Autor: Francisco Antonio Tapias Bravo

Aquí dejo la configuración que he usado para monitorizar con Monit, los servicios Apache, MySql, ssh y el espacio de disco duro

```
check process apache with pidfile /var/run/apache.pid
start program = "/etc/init.d/apache start"
stop program  = "/etc/init.d/apache stop"
if failed host localhost port 80 protocol http
and request "/index.html" then restart
check device rootfs with path /dev/ubd0
if space usage > 3 GB then alert
check process mysql with pidfile /var/run/mysqld/mysqld.pid
group database
start program = "/etc/init.d/mysql start"
stop  program = "/etc/init.d/mysql stop"
if failed unix /var/run/mysqld/mysqld.sock then restart
if mem > 60 Mb then restart
if 5 restarts within 5 cycles then timeout
check process sshd with pidfile /var/run/sshd.pid
start program  "/etc/init.d/ssh start"
stop program  "/etc/init.d/ssh stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
```
