четвъртък, октомври 23, 2008

monit

Поради някаква причина, по някое време smpt-то (postfix) и/или
POP3/IMAP4 (courier-pop/imap) по някое време забива или просто
заспива... след определено време се усеща и си тръгва или влиза някой и
рестартира service и то си тръгва. За РОР3-то ясно - в логовете има
courierpop3login: 80 maximum active connections което се появява дори и
след като вдигна мах connection на 800... някой някакъв вирус е хванал
сигурно; но пък за smtp-to нищо.Дори и като вдигна дебъг левела пак нищо
съществено. В крайна сметка на Pafkata
<http://koldamov.com/blog>препоръката - monit
<http://www.tildeslash.com/monit/>
Готино тулче дето върши готина работа. Някой ден ще трябва да го направя
да следи състоянието на диска и при препълване над определен % да
стартира скрипт дето чисти мейл боксове от писма по-стари от 90 дни и
съм ОК.
monitrc.current
set daemon 60
set logfile /var/log/monit/monit.log
set mailserver mail.handybg.com
set alert sysadmin_at_handybg.com

set httpd port 2812 and
use address 212.50.27.82 # only accept connection from localhost
allow localhost # allow localhost to connect to the server and
allow 10.0.0.0/8
allow 212.50.27.80/28
allow 194.12.234.0/24
allow admin:admin # require user 'admin' with password 'monit'

check system mail.handybg.com
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 75% then alert
if cpu usage (user) > 70% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert

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


check process courier-pop with pidfile /var/run/courier/pop3d.pid
group mail
start program = "/etc/init.d/courier-pop start"
stop program = "/etc/init.d/courier-pop stop"
if failed port 110 protocol pop then restart
if 5 restarts within 5 cycles then timeout
depends on courier-pop-rc

check file courier-pop-rc with path /etc/init.d/courier-pop
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


check process courier-imap with pidfile /var/run/courier/imapd.pid
group mail
start program = "/etc/init.d/courier-imap start"
stop program = "/etc/init.d/courier-imap stop"
if failed port 143 protocol imap then restart
if 5 restarts within 5 cycles then timeout
depends on courier-imap-rc

check file courier-imap-rc with path /etc/init.d/courier-imap
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

Няма коментари: