[root@server monit.d]# cat amavisd
check process amavisd with pidfile /var/run/amavisd/amavisd.pid
group mail
group backup
start program = "/etc/init.d/amavisd start"
stop program = "/etc/init.d/amavisd stop"
if failed port 10024 protocol smtp then restart
if 5 restarts within 5 cycles then timeout

[root@server monit.d]# cat clamd.amavisd
check process clamavd with pidfile /var/run/amavisd/clamd.pid
group virus
group backup
start program = "/etc/init.d/clamd.amavisd start"
stop program = "/etc/init.d/clamd.amavisd stop"
if failed unixsocket /var/spool/amavisd/clamd.sock 2 cycles then restart # protocol clamav
if 5 restarts within 5 cycles then timeout

[root@server monit.d]# cat crond
check process cron with pidfile /var/run/crond.pid
group system
start program = "/etc/init.d/crond start"
stop program = "/etc/init.d/crond stop"
if 5 restarts within 5 cycles then timeout

[root@server monit.d]# cat cyrus-imapd
check process cyrus-imapd with pidfile /var/run/cyrus-master.pid
group mail
group backup
start program = "/etc/init.d/cyrus-imapd start"
stop program = "/etc/init.d/cyrus-imapd stop"
if failed port 143 protocol imap then restart
if 5 restarts within 5 cycles then timeout

check file maillog with path /var/log/maillog
group mail
if match error then alert

[root@server monit.d]# cat dirsrv
check process dirsrv with pidfile /var/run/dirsrv/slapd-SERVER.pid
group database
group backup
start program = "/etc/init.d/dirsrv start"
stop program = "/etc/init.d/dirsrv stop"
# if failed host 192.168.1.1 port 389 protocol ldap3 then restart
if failed host 192.168.1.1 port 389 then restart
if 5 restarts within 5 cycles then timeout

[root@server monit.d]# cat dirsrv-admin
check process dirsrv-admin with pidfile /var/run/dirsrv/admin-serv.pid mode manual
group system
group backup
start program = "/etc/init.d/dirsrv-admin start"
stop program = "/etc/init.d/dirsrv-admin stop"
if 5 restarts within 5 cycles then timeout

[root@server monit.d]# cat fetchmail
check process fetchmail with pidfile /var/run/fetchmail.pid
group mail
group backup
start program = "/etc/init.d/fetchmail start"
stop program = "/etc/init.d/fetchmail stop"
if 5 restarts within 5 cycles then timeout

check file fetchmail.log with path /var/log/fetchmail.log
if match error then alert

[root@server monit.d]# cat hosts
check host localhost with address localhost
group backup
IF FAILED URL http://localhost/roundcubemail 2 CYCLES THEN alert

check host external with address k---.selfhost.eu
group backup
IF FAILED URL https://k---.selfhost.eu/roundcubemail 2 CYCLES THEN exec "/usr/bin/wget -O http://carol.selfhost.de/update?username=---&password=..."

check host pop.gmx.net with address pop.gmx.net mode manual group externals
IF FAILED port 110 protocol pop timeout 15 seconds for 5 CYCLES THEN alert
check host mail.gmx.net with address mail.gmx.net mode manual group externals
IF FAILED port 25 protocol smtp timeout 15 seconds for 5 CYCLES THEN alert

check host imap-mail.outlook.com with address imap-mail.outlook.com mode manual group externals
IF FAILED port 143 protocol imap timeout 15 seconds for 5 CYCLES THEN alert
#IF FAILED port 443 type tcpssl protocol imap timeout 15 seconds for 5 CYCLES THEN alert
check host smtp.live.com with address smtp.live.com mode manual group externals
IF FAILED port 25 protocol smtp timeout 15 seconds for 5 CYCLES THEN alert

check host imap.web.de with address imap.web.de mode manual group externals
IF FAILED port 143 protocol imap timeout 15 seconds for 5 CYCLES THEN alert
check host smtp.web.de with address smtp.web.de mode manual group externals
IF FAILED port 25 protocol smtp timeout 15 seconds for 5 CYCLES THEN alert

check host pop.thozie.de with address pop.thozie.de mode manual group externals
IF FAILED port 110 protocol pop timeout 15 seconds for 5 CYCLES THEN alert
check host smtp.thozie.de with address smtp.thozie.de mode manual group externals
IF FAILED port 25 protocol smtp timeout 15 seconds for 5 CYCLES THEN alert

# set unmonitored externals

[root@server monit.d]# cat httpd
check process httpd with pidfile /var/run/httpd/httpd.pid
group httpd
group backup
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
# if failed host localhost port 80
# protocol HTTP request "/~hauk/monit/token" then restart
# if failed host 192.168.1.1 port 443 type TCPSSL
# certmd5 12-34-56-78-90-AB-CD-EF-12-34-56-78-90-AB-CD-EF
# protocol HTTP request http://localhost/~hauk/monit/token then restart
if 5 restarts within 5 cycles then timeout
# depends on apache_bin
# depends on apache_rc

# check file apache_bin with path /opt/apache/bin/httpd
# group www
# if failed checksum then unmonitor
# if failed permission 755 then unmonitor
# if failed uid root then unmonitor
# if failed gid root then unmonitor

# check file apache_rc with path /etc/init.d/apache
# group www
# if failed checksum then unmonitor
# if failed permission 755 then unmonitor
# if failed uid root then unmonitor
# if failed gid root then unmonitor

check file error_log with path /var/log/httpd/error_log
group httpd

#check file ssl_error_log with path /var/log/httpd/ssl_error_log
# group httpd

[root@server monit.d]# cat kolabd
check process kolabd with pidfile /var/run/kolabd/kolabd.pid depends on dirsrv, cyrus-imapd
group kolab
group backup
start program = "/etc/init.d/kolabd start"
stop program = "/etc/init.d/kolabd stop"
if 5 restarts within 5 cycles then timeout

[root@server monit.d]# cat kolab-saslauthd
check process kolab-saslauthd with pidfile /var/run/kolab-saslauthd/kolab-saslauthd.pid
group kolab
group backup
start program = "/etc/init.d/kolab-saslauthd start"
stop program = "/etc/init.d/kolab-saslauthd stop"
if 5 restarts within 5 cycles then timeout

[root@server monit.d]# cat minidlna
check process minidlna with pidfile /var/run/minidlna.pid
group share
group backup
start program = "/etc/init.d/minidlna start"
stop program = "/etc/init.d/minidlna stop"
if failed port 8200 type tcp then restart
if 5 restarts within 5 cycles then timeout

[root@server monit.d]# cat mpd
check process mpd with pidfile /var/run/mpd.pid
group share
group backup
start program = "/etc/init.d/mpd start"
stop program = "/etc/init.d/mpd stop"
if failed port 6600 type tcp then restart
if 5 restarts within 5 cycles then timeout

[root@server monit.d]# cat mysqld
check process mysql with pidfile /var/run/mysqld/mysqld.pid
group database
group backup
start program = "/etc/init.d/mysqld start"
stop program = "/etc/init.d/mysqld stop"
if failed host localhost port 3306 protocol mysql then restart
if 5 restarts within 5 cycles then timeout

check file mysqld.log with path /var/log/mysqld.log
group database

[root@server monit.d]# cat postfix
check process postfix with pidfile /var/spool/postfix/pid/master.pid depends on dirsrv
group mail
group backup
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

[root@server monit.d]# cat smbd
check process smbd with pidfile /var/run/smbd.pid
group share
group backup
start program = "/etc/init.d/smb start"
stop program = "/etc/init.d/smb stop"
if failed host localhost port 139 type TCP then restart
if 5 restarts within 5 cycles then timeout

[root@server monit.d]# cat sshd
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

[root@server monit.d]# cat system
check filesystem SSD_root with path /
check filesystem SSD_home with path /home
check filesystem SSD_temp with path /dev/shm
check filesystem SSD_boot with path /dev/sdb1
check filesystem HD with path /dev/sda1
check filesystem USBHD with path /dev/sdd1 mode passive

check file boot.log with path /var/log/boot.log
if changed timestamp then alert

check file smartctl.health.log with path /var/log/smartctl.health.log
if match fail then alert