Skip to content
Snippets Groups Projects

Resolve "Surveillance interne des serveur"

+ 10
2
@@ -54,14 +54,22 @@ 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
# Monit all partition without swap and boot
list_of_part=(`grep -v "#\|swap\|noauto" /etc/fstab | awk '{print $2}'`)
echo "" > ./$$-parts
for part in "${list_of_part[@]}"
do
echo -e "check device root with path $part\n if SPACE usage > 75% then alert\nif SPACE usage > 75% timeout 86400 seconds then alert\n\n" >> ./$$-parts
done
mv ./$$-parts /etc/monit/conf-available/disc
systemctl restart monit
# Check rootkits and antivirus
if [ `grep -c "^ALLOWHIDDENDIR=/etc/.java" /etc/rkhunter.conf` -eq 0 ]
then
Loading