Add monit for disk>85% into pmon docker (#582)

* Add monit for disk>85% into pmon docker

* Revert "Add monit for disk>85% into pmon docker"

This reverts commit 9cbbf591c08bce4b52a0f68cbbddae102d7fc614.

* Install monit in base image
This commit is contained in:
Qi Luo 2017-05-18 10:57:19 -07:00 committed by GitHub
parent a7fbd775c6
commit 8ebf0b0832

View File

@ -182,6 +182,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
python \
python-setuptools \
rsyslog \
monit \
python-apt \
traceroute \
iputils-ping \
@ -209,6 +210,27 @@ sudo cp -f files/sshd/sshd.service $FILESYSTEM_ROOT/lib/systemd/system/ssh.servi
## Config sshd
sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTEM_ROOT
## Config monit
sudo sed -i '
s/^# set logfile syslog/set logfile syslog/;
s/^\s*set logfile \/var/# set logfile \/var/;
s/^# set httpd port/set httpd port/;
s/^# use address localhost/ use address localhost/;
s/^# allow localhost/ allow localhost/;
s/^# allow admin:monit/ allow admin:monit/;
s/^# allow @monit/ allow @monit/;
s/^# allow @users readonly/ allow @users readonly/
' $FILESYSTEM_ROOT/etc/monit/monitrc
sudo tee -a $FILESYSTEM_ROOT/etc/monit/monitrc > /dev/null <<'EOF'
check filesystem root-aufs with path /
if space usage > 90% for 5 times within 10 cycles then alert
check system $HOST
if memory usage > 90% for 5 times within 10 cycles then alert
if cpu usage (user) > 90% for 5 times within 10 cycles then alert
if cpu usage (system) > 90% for 5 times within 10 cycles then alert
EOF
## Config sysctl
sudo mkdir -p $FILESYSTEM_ROOT/var/core
sudo augtool --autosave "