Fixed typo's in config
This commit is contained in:
11
conf.sh
11
conf.sh
@@ -2,6 +2,9 @@ mrepo=https://git.ictmaatwerk.com/VPS-scripts/Monit
|
|||||||
mbranch=main
|
mbranch=main
|
||||||
|
|
||||||
mkdir /var/run/monit
|
mkdir /var/run/monit
|
||||||
|
chmod 0755 /var/run/monit
|
||||||
|
chown www-data:root /var/run/monit
|
||||||
|
echo "D /var/run/monit 0755 www-data root -" > /usr/lib/tmpfiles.d/monitSock.conf
|
||||||
|
|
||||||
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
|
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
|
||||||
monitconf=/etc/monit/monitrc
|
monitconf=/etc/monit/monitrc
|
||||||
@@ -23,20 +26,20 @@ elif [ "$shortdist" = "el8" ]; then
|
|||||||
monitPhpPid=/var/opt/remi/php"${phpver//.}"/run/php-fpm/php-fpm.pid
|
monitPhpPid=/var/opt/remi/php"${phpver//.}"/run/php-fpm/php-fpm.pid
|
||||||
monitPhpPro=php-fpm
|
monitPhpPro=php-fpm
|
||||||
|
|
||||||
semanage fcontext -at httpd_sys_rw_content_t "/var/run/monit/.*)?"
|
semanage fcontext -at httpd_sys_rw_content_t "/var/run/monit/(.*)?"
|
||||||
restorecon -R -v "/var/run/monit"
|
restorecon -R -v "/var/run/monit"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl stop monit
|
systemctl stop monit
|
||||||
|
|
||||||
|
if [ ! -d "/var/lib/monit" ] ; then mkdir -p /var/lib/monit; fi
|
||||||
|
mkdir -p /etc/monit/conf.d
|
||||||
|
|
||||||
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/conf/monit/monitrc -o $monitconf
|
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/conf/monit/monitrc -o $monitconf
|
||||||
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/conf/monit/monitwebsocket -o /etc/monit/websocket
|
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/conf/monit/monitwebsocket -o /etc/monit/websocket
|
||||||
touch /opt/MonitNotify.sh
|
touch /opt/MonitNotify.sh
|
||||||
chmod +x /opt/MonitNotify.sh
|
chmod +x /opt/MonitNotify.sh
|
||||||
|
|
||||||
if [ ! -d "/var/lib/monit" ] ; then mkdir -p /var/lib/monit; fi
|
|
||||||
mkdir -p /etc/monit/conf.d
|
|
||||||
|
|
||||||
|
|
||||||
SysServiceList=$(systemctl list-units --full -all)
|
SysServiceList=$(systemctl list-units --full -all)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
## Monit control file ##
|
## Monit control file ##
|
||||||
########################
|
########################
|
||||||
set daemon 30 # check services at 2-minute intervals
|
set daemon 30 # check services at 2-minute intervals
|
||||||
|
with start delay 60
|
||||||
set log /var/log/monit.log
|
set log /var/log/monit.log
|
||||||
set idfile /var/lib/monit/id
|
set idfile /var/lib/monit/id
|
||||||
|
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ check process nginx with pidfile /var/run/nginx.pid
|
|||||||
start program = "/bin/systemctl start nginx"
|
start program = "/bin/systemctl start nginx"
|
||||||
stop program = "/bin/systemctl stop nginx"
|
stop program = "/bin/systemctl stop nginx"
|
||||||
if not exist for 1 cycles then restart
|
if not exist for 1 cycles then restart
|
||||||
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: Nginx"
|
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'"
|
else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Nginx'"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
check system $HOST
|
check system $HOST
|
||||||
#SystemLoad
|
#SystemLoad
|
||||||
if loadavg (5min) > 4 then exec "/opt/MonitNotify.sh 'SYS-WARN:: High load (5min)'"
|
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)'"
|
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)'"
|
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)'"
|
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: load (15min)'"
|
||||||
|
|
||||||
#Memory
|
#Memory
|
||||||
@@ -18,7 +18,7 @@ check system $HOST
|
|||||||
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: 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'"
|
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'"
|
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'"
|
if cpu usage > 200% for 4 cycles then exec "/opt/MonitNotify.sh 'SYS-WARN: CPU threshold'"
|
||||||
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: CPU threshold'"
|
else if recovered then exec "/opt/MonitNotify.sh 'SYS-OK: CPU threshold'"
|
||||||
|
|
||||||
#Disk
|
#Disk
|
||||||
|
|||||||
Reference in New Issue
Block a user