Service Monitoring

Aus Weis nix
Wechseln zu: Navigation, Suche

Monit


monitrc Examples

Monit https:// web interface

Follow instructions in Howto

set httpd port 2822 and
    SSL ENABLE
    PEMFILE  /var/certs/monit.pem
    allow user:pass

and add port 2822 to firewall (i.e. /etc/Bastille/bastille-firewall.cfg).

SSH

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
Mysql
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 host 127.0.0.1 port 3306 then restart
  if 5 restarts within 5 cycles then timeout
Apache
check process apache with pidfile /var/run/apache2.pid
  group www
  start program = "/etc/init.d/apache2 start"
  stop program  = "/etc/init.d/apache2 stop"
  if failed host www.ferzkopp.net port 80 protocol http
     and request "/monit" then restart
  if cpu is greater than 80% for 2 cycles then alert
  if cpu > 90% for 5 cycles then restart
  if totalmem > 500 MB for 5 cycles then restart
  if children > 250 then restart
  if loadavg(5min) greater than 10 for 8 cycles then stop
  if 3 restarts within 5 cycles then timeout

and

echo "OK" >/var/www/monit
Postfix
check process postfix with pidfile /var/spool/postfix/pid/master.pid
  group mail
  start program = "/etc/init.d/postfix start" 
  stop  program = "/etc/init.d/postfix stop"  
  if failed port 25 protocol smtp then restart
  if 5 restarts within 5 cycles then timeout
Amavis
check process amavisd with pidfile /var/run/amavis/amavisd.pid
    group mail
    start program = "/etc/init.d/amavis start"
    stop  program = "/etc/init.d/amavis stop"
    if failed port 10024 protocol smtp then restart
    if 5 restarts within 5 cycles then timeout

and add port 10024 to firewall (i.e. /etc/Bastille/bastille-firewall.cfg).