Skip to content

Commit

Permalink
Add monit for disk>85% into pmon docker (#582)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
qiluo-msft authored May 18, 2017
1 parent a7fbd77 commit 8ebf0b0
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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 "
Expand Down

0 comments on commit 8ebf0b0

Please sign in to comment.