Usualy monit use pid file to monitoring process, for example
Epel repo(6 version) have 5.1.1 version that don't support this feature
Therefore, you have to download binary from http://mmonit.com/monit/download/
and use it.
#Example
check process postfix with pidfile /var/spool/postfix/pid/master.pidI don't find qmail pid file and use new feature in 5.2.4 - procmatch
Epel repo(6 version) have 5.1.1 version that don't support this feature
Therefore, you have to download binary from http://mmonit.com/monit/download/
and use it.
#Example
check process qmaild matching "qmail-snmpd"
alert xxx@yyy.com but not on {pid, ppid, uptime} group qmail start program = "/etc/init.d/qmail start" stop program = "/etc/init.d/qmail stop" if failed port 25 protocol smtp then restart if 5 restarts within 5 cycles then timeout
You can use monit wrapper method as well.
#Example
/etc/monit.d/qmailwrap:
check process qmailwrap with pidfile /var/run/qmailwrap.pid alert xxx@yyy.com
start program = "/var/qmail/qmailwrap.sh start" stop program = "/var/qmail/qmailwrap.sh stop" if failed host a.b.c.d port 25 type tcp then alert if 5 restarts within 5 cycles then timeout
/var/qmail/qmailwrap.sh:
#!/bin/bash case $1 in start) echo $$ > /var/run/qmailwrap.pid; exec 2>&1 /var/qmail/supervise/qmail-smtpd/run 1>/var/log/qmailwrap.log ;; stop) kill `cat /var/run/qmailwrap.pid` ;; *) echo "usage: qmailwrap {start|stop}" ;; esac exit 0
/var/qmail/supervise/qmail-smtpd/run:
#!/bin/sh
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
LOCAL=`head -1 /var/qmail/control/me`
if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then
echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in
echo /var/qmail/supervise/qmail-smtpd/run
exit 1
fi
if [ ! -f /var/qmail/control/rcpthosts ]; then
echo "No /var/qmail/control/rcpthosts!"
echo "Refusing to start SMTP listener because it'll create an open relay"
exit 1
fi
exec /usr/local/bin/softlimit -m 40000000 \
/usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \ -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
http://cr.yp.to/qmail.html
http://www.lifewithqmail.org/lwq.html
Комментариев нет:
Отправить комментарий