Август 08, 2020, 04:14:35 pm
16 Сообщений - 6 Тем - 7 Пользователей

Автор Тема: Конфигурация Monit  (Прочитано 4093 раз)

Оффлайн Dr.sergeus

  • Administrator
  • Newbie
  • *****
  • Сообщений: 10
  • Карма: 0
    • Просмотр профиля
Конфигурация Monit
« : Март 18, 2013, 03:48:10 pm »
Предлагаем Вашему вниманию гарантированно работающую конфигурацию Monit на основные сервисы. Просто скопируйте код в файл /etc/monit/monitrc, заменив XX.XX.XX.XX на свой ip адрес:

set daemon 120
set logfile syslog facility log_daemon
set mailserver localhost # primary mailserver
set mail-format { from: monit@monitorserver.com }

set httpd port 2812 and
     use address XX.XX.XX.XX
allow admin:monit

# Monitoring the apache2 web services.

check process apache2 with pidfile /var/run/apache2.pid
start program = "/etc/init.d/apache2 start"
stop program = "/etc/init.d/apache2 stop"
if cpu is greater than 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 3 restarts within 5 cycles then timeout
group server

#Monitoring Mysql Service

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

#Monitoring ssh Service

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

#Monitoring postfix Service

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
   depends on postfix_rc

 check file postfix_rc with path /etc/init.d/postfix
   group mail
   if failed checksum then unmonitor
   if failed permission 755 then unmonitor
   if failed uid root then unmonitor
   if failed gid root then unmonitor

#Monitoring proftpd Service

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

#Monitoring crond Service

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

#Monitoring named Service

check process bind with pidfile /var/run/named/named.pid
   group system
   start program = "/etc/init.d/bind9 start"
   stop  program = "/etc/init.d/bind9 stop"
   if 5 restarts within 5 cycles then timeout
Напоминаю: бесплатная помощь - по мере возможности!