# Мониторинг самого Monit-сервера
#check process httpd with pidfile /var/run/httpd/httpd.pid
#start program = "/etc/init.d/httpd start"
#stop program = "/etc/init.d/httpd stop"
#if failed host 127.0.0.1 port 80 protocol http then alert
#if 5 restarts within 5 cycles then timeout
#check process exim with pidfile /var/run/exim.pid
#start program = "/etc/init.d/exim start"
#stop program = "/etc/init.d/exim stop"
#if 5 restarts within 5 cycles then timeout
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
if failed host 192.168.1.60 port 80 protocol http then alert
if 3 restarts within 3 cycles then timeout
check process named with pidfile /var/run/named.pid
start program = "/etc/init.d/named start"
stop program = "/etc/init.d/named stop"
if 5 restarts within 5 cycles then timeout
check process fail2ban with pidfile /var/run/fail2ban/fail2ban.pid
start program = "/etc/init.d/fail2ban start"
stop program = "/etc/init.d/fail2ban stop"
if 5 restarts within 5 cycles then timeout
#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
check process dkim-milter with pidfile /var/run/dkim-milter/dkim-milter.pid
start program = "/etc/init.d/dkim-milter start"
stop program = "/etc/init.d/dkim-milter stop"
if failed host 127.0.0.1 port 8891 then restart
if 5 restarts within 5 cycles then timeout
check process memcached with pidfile /var/run/memcached/memcached.pid
start program = "/etc/init.d/memcached start"
stop program = "/etc/init.d/memcached stop"
if failed host 127.0.0.1 port 11211 then restart
if 3 restarts within 5 cycles then timeout
check process redis-server with pidfile /var/run/redis/redis.pid
start program = "/etc/init.d/redis start"
stop program = "/etc/init.d/redis stop"
if failed host 127.0.0.1 port 6379 then restart
if 3 restarts within 5 cycles then timeout
check process rsyslog with pidfile /var/run/syslogd.pid
start program = "/etc/init.d/rsyslog start"
stop program = "/etc/init.d/rsyslog stop"
if 3 restarts within 5 cycles then timeout
check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
start program = "/etc/init.d/php-fpm start"
stop program = "/etc/init.d/php-fpm stop"
if failed unixsocket /var/run/php5-fpm.sock then restart
#if failed host 127.0.0.1 port 9000 then restart
if 3 restarts within 5 cycles then timeout
check process atop with pidfile /var/run/atop.pid
start program = "/etc/init.d/atop start"
stop program = "/etc/init.d/atop stop"
if 3 restarts within 5 cycles then timeout
check process munin-node with pidfile /var/run/munin/munin-node.pid
start program = "/etc/init.d/munin-node start"
stop program = "/etc/init.d/munin-node stop"
if failed host 127.0.0.1 port 4949 then restart
if 3 restarts within 5 cycles then timeout
check process openvpn with pidfile /var/run/openvpn/openvpn.pid
start program = "/etc/init.d/openvpn start"
stop program = "/etc/init.d/openvpn stop"
if failed host 192.168.1.60 port 1194 then restart
if 3 restarts within 5 cycles then timeout
check process keepalived with pidfile /var/run/keepalived.pid
start program = "/etc/init.d/keepalived start" #with timeout 60 seconds
stop program = "/etc/init.d/keepalived stop"
check process sshd with pidfile /var/run/sshd.pid
start program = "/etc/init.d/sshd start"
stop program = "/etc/init.d/sshd stop"
if failed port 22 protocol ssh then restart
if 5 restarts within 5 cycles then timeout
check process dovecot with pidfile /var/run/dovecot/master.pid
start program = "/etc/init.d/dovecot start"
stop program = "/etc/init.d/dovecot stop"
if 3 restarts within 3 cycles then timeout
check process ntpd with pidfile /var/run/ntpd.pid
start program = "/etc/init.d/ntpd start"
stop program = "/etc/init.d/ntpd stop"
if failed host 127.0.0.1 port 123 type udp then alert
if 5 restarts within 5 cycles then timeout
check process crond with pidfile /var/run/crond.pid
start program = "/etc/init.d/crond start"
stop program = "/etc/init.d/crond stop"
check process postfix with pidfile /var/spool/postfix/pid/master.pid
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
check process mmm_agentd with pidfile /var/run/mysql-mmm/mmm_agentd.pid
start program = "/etc/init.d/mysql-mmm-agent start"
stop program = "/etc/init.d/mysql-mmm-agent stop"
if 5 restarts within 5 cycles then timeout
check process mysql with pidfile /var/lib/mysql/lb02.kamaok.org.ua.pid
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
if 5 restarts within 5 cycles then timeout
#Подключения оповещения при недоступности определенных портов на различных удаленных серверах
check host lb01.kamaok.org.ua with address 192.168.1.61
if failed icmp type echo count 5 with timeout 10 seconds then alert
if failed port 22 protocol ssh then alert
if failed port 4949 then alert
if failed port 80 then alert
if failed port 11211 then alert
if failed port 25 then alert
if failed port 143 then alert
if failed port 11211 then alert
check host app01.kamaok.org.ua with address 192.168.1.63
if failed icmp type echo count 5 with timeout 10 seconds then alert
if failed port 22 protocol ssh then alert
if failed port 4949 then alert
if failed port 9989 then alert
if failed port 80 protocol HTTP then alert
if failed port 11211 then alert
if failed port 25 then alert
if failed port 8080 then alert
check host app02.kamaok.org.ua with address 192.168.1.64
if failed icmp type echo count 5 with timeout 10 seconds then alert
if failed port 22 protocol ssh then alert
if failed port 4949 then alert
if failed port 9989 then alert
if failed port 80 protocol HTTP then alert
if failed port 11211 then alert
if failed port 25 then alert
if failed port 8080 then alert
alert root@localhost