From a34b05a7fbea6a998e4a9333eb8f2d6f997be54d Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Wed, 21 Dec 2022 15:50:10 +0100 Subject: [PATCH] Install monit to monitor disc space usage --- upgradeAll.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/upgradeAll.sh b/upgradeAll.sh index b5a574f..671856c 100644 --- a/upgradeAll.sh +++ b/upgradeAll.sh @@ -51,6 +51,17 @@ then /bin/bash $customfile fi +# install monit if not installed +if [ -z "$(dpkg -l | grep ' monit ')" ]; then + apt-get update && apt-get install -y monit + echo -e 'check device root with path /\n if SPACE usage > 75% then alert\n\ncheck device home with path /home\n if SPACE usage > 75% then alert' > /etc/monit/conf-available/disc + ln -s /etc/monit/conf-available/disc /etc/monit/conf-enabled/ + sed -i 's/# set httpd/set httpd/' /etc/monit/monitrc + sed -i 's/^# allow localhost/ allow localhost/' /etc/monit/monitrc + echo -e "set mailserver 127.0.0.1\nset mail-format { from: Monit <monit@$DOMAIN>}\nset alert root@localhost" >> /etc/monit/monitrc + systemctl restart monit +fi + # Check rootkits and antivirus if [ `grep -c "^ALLOWHIDDENDIR=/etc/.java" /etc/rkhunter.conf` -eq 0 ] then @@ -71,7 +82,7 @@ else cat /var/log/clamav.log fi -df -h +monit status # Check docker is running if [ ! -z "`echo $MODS | grep -i collabora`" ] -- GitLab