Skip to content

Instantly share code, notes, and snippets.

@piraveen
Last active January 3, 2016 21:41
Show Gist options
  • Save piraveen/408371572bb6d2711665 to your computer and use it in GitHub Desktop.
Save piraveen/408371572bb6d2711665 to your computer and use it in GitHub Desktop.

Configuration de Monit de base

set daemon 120 with start delay 240 set logfile syslog facility log_daemon

set mailserver localhost

set eventqueue basedir /var/monit slots 100

set mail-format { from: monit@$HOST subject: $SERVICE $EVENT at $DATE message: Monit $ACTION $SERVICE at $DATE on $HOST }

set alert root@localhost set httpd port 4598 and allow monit:monitor

Services

Apache2

check process apache with pidfile /var/run/apache2.pid group apache start program = "/etc/init.d/apache2 start" with timeout 60 seconds stop program = "/etc/init.d/apache2 stop" if cpu > 70% for 2 cycles then alert if cpu > 90% for 5 cycles then restart if children > 250 then restart if failed host localhost port 80 then restart if 5 restarts within 5 cycles then timeout

Cron

check process cron with pidfile /var/run/crond.pid group system start program = "/etc/init.d/cron start" stop program = "/etc/init.d/cron stop" if 5 restarts within 5 cycles then timeout

Munin Node

check process munin-node with pidfile /var/run/munin/munin-node.pid group system start program = "/etc/init.d/munin-node start" stop program = "/etc/init.d/munin-node stop" if failed host localhost port 4949 then restart if 5 restarts within 5 cycles then timeout

MySQL

check process mysqld 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 host 127.0.0.1 port 3306 then restart if 5 restarts within 5 cycles then timeout

SSH

check process sshd with pidfile /var/run/sshd.pid group ssh start program = "/etc/init.d/ssh start" stop program = "/etc/init.d/ssh stop" if failed host 127.0.0.1 port 22 protocol ssh then restart if 5 restarts within 5 cycles then timeout

FTP

check process proftpd with pidfile /var/run/proftpd.pid start program = "/etc/init.d/proftpd start" stop program = "/etc/init.d/proftpd stop" if failed port 21 protocol ftp then restart if 5 restarts within 5 cycles then timeout

Disk

SDA1

check device sda1 with path /dev/sda1 group system if space usage > 85% then alert if space usage > 90% then alert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment