Skip to content

Instantly share code, notes, and snippets.

@teol
Last active May 22, 2021 11:40
Show Gist options
  • Save teol/def590a74305b1356034c9ef48598495 to your computer and use it in GitHub Desktop.
Save teol/def590a74305b1356034c9ef48598495 to your computer and use it in GitHub Desktop.
/etc/monit/conf-available/
check process crowdsec with pidfile /var/run/crowdsec.pid
#monit procmatch crowdsec
#monit procmatch cs-firewall-bouncer
check process gitea with pidfile /var/run/gitea.pid
start program = "/etc/init.d/gitea start"
stop program = "/etc/init.d/gitea stop"
if failed host 127.0.0.1 port 3000 protocol http then restart
if failed host xxx.xxxx.xx port 443 type tcpssl protocol http
with timeout 15 seconds
then alert
if 3 restarts within 5 cycles then timeout
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
group database
group mysql
start program = "/etc/init.d/mysql start"
stop program = "/etc/init.d/mysql stop"
if failed host localhost port 3306 protocol mysql with timeout 15 seconds for 3 times within 4 cycles then restart
if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 3 times within 4 cycles then restart
if 5 restarts with 5 cycles then timeout
check process memcached with pidfile /var/run/memcached/memcached.pid
group cache
group memcached
start program = "/etc/init.d/memcached start"
stop program = "/etc/init.d/memcached stop"
if failed host 127.0.0.1 port 11211 and protocol memcache then restart
if cpu > 60% for 2 cycles then alert
if cpu > 98% for 5 cycles then restart
if 5 restarts within 20 cycles then timeout
# depend memcache_bin
# depend memcache_rc
# check file memcache_bin with path /usr/bin/memcached
# group memcached
# include /etc/monit/templates/rootbin
# check file memcache_rc with path /etc/init.d/memcached
# group memcached
# include /etc/monit/templates/rootbin
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 xx.xx.xx.xx port 80 protocol http then restart
if failed host www.xxx.fr port 443 type tcpssl protocol http
with timeout 15 seconds
then alert
if cpu > 60% for 2 cycles then alert
if 3 restarts within 5 cycles then timeout
check process opendkim with pidfile /var/run/opendkim/opendkim.pid
start program = "/etc/init.d/opendkim start"
stop program = "/etc/init.d/opendkim stop"
check process opendmarc with pidfile /var/run/opendmarc/opendmarc.pid
start program = "/etc/init.d/opendmarc start"
stop program = "/etc/init.d/opendmarc stop"
check process php7.4-fpm with pidfile /var/run/php/php7.4-fpm.pid
start program = "/etc/init.d/php7.4-fpm start" with timeout 60 seconds
stop program = "/etc/init.d/php7.4-fpm stop"
if failed unixsocket /var/run/php/php7.4-fpm.sock then restart
check process postfix with pidfile /var/spool/postfix/pid/master.pid
group system
group mail
group postfix
start program = "/etc/init.d/postfix start"
stop program = "/etc/init.d/postfix stop"
if failed host localhost port 25 with protocol smtp for 2 times within 3 cycles then restart
if 5 restarts with 5 cycles then timeout
depend master_bin
depend postfix_rc
depend postdrop_bin
depend postqueue_bin
depend master_cf
depend main_cf
check file master_bin with path /usr/lib/postfix/sbin/master
group postfix
include /etc/monit/templates/rootbin
check file postdrop_bin with path /usr/sbin/postdrop
group postfix
if failed checksum then unmonitor
if failed permission 2555 then unmonitor
if failed uid root then unmonitor
if failed gid postdrop then unmonitor
check file postqueue_bin with path /usr/sbin/postqueue
group postfix
if failed checksum then unmonitor
if failed permission 2555 then unmonitor
if failed uid root then unmonitor
if failed gid postdrop then unmonitor
check file master_cf with path /etc/postfix/master.cf
group postfix
include /etc/monit/templates/rootrc
check file main_cf with path /etc/postfix/main.cf
group postfix
include /etc/monit/templates/rootrc
check file postfix_rc with path /etc/init.d/postfix
group postfix
include /etc/monit/templates/rootbin
check process redis-server with pidfile "/var/run/redis/redis-server.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout
check process seafile-server with pidfile /opt/seafile/seafile/pids/seaf-server.pid
start program = "/opt/seafile/seafile-server-latest/seafile.sh start"
stop program = "/opt/seafile/seafile-server-latest/seafile.sh stop"
if failed host 127.0.0.1 port 8082 type tcp then restart
if 3 restarts within 5 cycles then timeout
check process seahub with pidfile /opt/seafile/seafile-server-latest/runtime/seahub.pid
start program = "/opt/seafile/seafile-server-latest/seahub.sh start"
stop program = "/opt/seafile/seafile-server-latest/seahub.sh stop"
if failed host 127.0.0.1 port 8000 protocol http then restart
if 3 restarts within 5 cycles then timeout
check process ccnet with pidfile /opt/seafile/pids/ccnet.pid
if failed unixsocket /opt/seafile/ccnet/ccnet.sock then alert
check process supervisord with pidfile /var/run/supervisord.pid
group supervisor
start program = "/etc/init.d/supervisord start"
stop program = "/etc/init.d/supervisord stop"
if failed unixsocket /var/run/php7.4-fpm.sock then restart
if 5 restarts within 5 cycles then timeout
check process teamspeak3-server with pidfile "/home/ts3/serverfiles/ts3server.pid"
start program = "/home/ts3/ts3server start"
as uid ts3 and gid ts3
stop program = "/home/ts3/ts3server stop"
as uid ts3 and gid ts3
if failed host 127.0.0.1 port 9987 type udp then restart
if 5 restarts within 5 cycles then timeout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment