Inital commit

This commit is contained in:
2021-01-08 11:06:07 +01:00
commit 8f9fb4fd5c
13 changed files with 368 additions and 0 deletions

6
conf/monit/apache.conf Normal file
View File

@@ -0,0 +1,6 @@
check process APApro with pidfile /var/run/APAserv/APAserv.pid
start program = "/usr/bin/systemctl start APAserv"
stop program = "/usr/bin/systemctl stop APAserv"
if not exist for 1 cycles then restart
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: Apache'"
else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Apache'"

10
conf/monit/fail2ban.conf Normal file
View File

@@ -0,0 +1,10 @@
check process fail2ban with pidfile /var/run/fail2ban/fail2ban.pid
start program = "/usr/bin/systemctl start fail2ban"
stop program = "/usr/bin/systemctl stop fail2ban"
if failed unixsocket /var/run/fail2ban/fail2ban.sock then restart
if failed unixsocket /var/run/fail2ban/fail2ban.sock for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: Fail2Ban Socket'"
else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Fail2Ban Socket'"
if not exist for 1 cycles then restart
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'Fail2Ban service'"
else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Fail2Ban service'"

18
conf/monit/monitrc Normal file
View File

@@ -0,0 +1,18 @@
########################
## Monit control file ##
########################
set daemon 30 # check services at 2-minute intervals
set log /var/log/monit.log
set idfile /var/lib/monit/id
set eventqueue
basedir /var/lib/monit/events # set the base directory where events will be stored
slots 100 # optionally limit the queue size
#WEBUIset httpd port 2812 and
#WEBUIallow admin:monit # require user 'admin' with password 'monit'
#WEBUI#use address localhost # only accept connection from localhost (drop if you use M/Monit)
#WEBUI#allow localhost # allow localhost to connect to the server and
include /etc/monit/conf.d/*

10
conf/monit/mysql.conf Normal file
View File

@@ -0,0 +1,10 @@
check process mysqld with pidfile /var/run/mysqld/mysqld.pid
start program = "/usr/bin/systemctl start MYSQLserv"
stop program = "/usr/bin/systemctl stop MYSQLserv"
if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 2 times within 5 cycles then restart
if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 4 times within 5 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: MySQL Socket'"
else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: MySQL Socket"
if not exist for 1 cycles then restart
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: MySQL service'"
else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: MySQL service'"

6
conf/monit/nginx.conf Normal file
View File

@@ -0,0 +1,6 @@
check process nginx with pidfile /var/run/nginx.pid
start program = "/usr/bin/systemctl start nginx"
stop program = "/usr/bin/systemctl stop nginx"
if not exist for 1 cycles then restart
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: Nginx"
else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Nginx'"

6
conf/monit/sshd.conf Normal file
View File

@@ -0,0 +1,6 @@
check process sshd with pidfile /var/run/sshd.pid
start program = "/usr/bin/systemctl start sshd"
stop program = "/usr/bin/systemctl stop sshd"
if not exist for 1 cycles then restart
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: SSHD'"
else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: SSHD'"

27
conf/monit/system.conf Normal file
View File

@@ -0,0 +1,27 @@
check system $HOST
#SystemLoad
if loadavg (5min) > 4 then exec "/opt/MonitNotify.sh 'SYS-WARN:: High load (5min)'"
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: load (5min)'"
if loadavg (15min) > 2 then exec "/opt/MonitNotify.sh 'SYS-WARN:: High load (15min)'"
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: load (15min)'"
#Memory
if memory usage > 90% for 4 cycles then exec "/opt/MonitNotify.sh 'WARN: Memory threshold'"
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: Memory threshold'"
if swap usage > 20% for 4 cycles then exec "/opt/MonitNotify.sh 'SYS-WARN: Swap threshold'"
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: Swap threshold'"
#CPU
if cpu usage (user) > 90% for 4 cycles then exec "/opt/MonitNotify.sh 'SYS-WARN: CPU(user) threshold'"
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: CPU(user) threshold'"
if cpu usage (system) > 80% for 4 cycles then exec "/opt/MonitNotify.sh 'SYS-WARN: CPU(sys) threshold'"
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: CPU(sys) threshold'"
if cpu usage (wait) > 80% for 4 cycles then exec"/opt/MonitNotify.sh 'SYS-WARN: CPU(wait) threshold'"
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: CPU(wait) threshold'"
if cpu usage > 200% for 4 cycles then exec "/opt/MonitNotify.sh "/opt/MonitNotify.sh 'SYS-WARN: CPU threshold'"
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: CPU threshold'"
#Disk
check device rootfs with path /
if SPACE usage > 80% then exec "/opt/MonitNotify.sh 'SYS-WARN: Disk quota'"
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: Disk quota'"

10
conf/php-fpm.conf Normal file
View File

@@ -0,0 +1,10 @@
check process PHPpro with pidfile PHPpid
start program = "/usr/bin/systemctl start PHPsrv"
stop program = "/usr/bin/systemctl stop PHPsrv"
if failed unixsocket PHPsock then restart
if failed unixsocket PHPsockfor 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: phpPHPver-fpm socket'"
else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: phpPHPver-fpm socket'"
if not exist for 1 cycles then restart
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: phpPHPver-fpm service'"
else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: phpPHPver-fpm service'"