Skip to content

Commit 8ebf0b0

Browse files
authored
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
1 parent a7fbd77 commit 8ebf0b0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

build_debian.sh

+22
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
182182
python \
183183
python-setuptools \
184184
rsyslog \
185+
monit \
185186
python-apt \
186187
traceroute \
187188
iputils-ping \
@@ -209,6 +210,27 @@ sudo cp -f files/sshd/sshd.service $FILESYSTEM_ROOT/lib/systemd/system/ssh.servi
209210
## Config sshd
210211
sudo augtool --autosave "set /files/etc/ssh/sshd_config/UseDNS no" -r $FILESYSTEM_ROOT
211212

213+
## Config monit
214+
sudo sed -i '
215+
s/^# set logfile syslog/set logfile syslog/;
216+
s/^\s*set logfile \/var/# set logfile \/var/;
217+
s/^# set httpd port/set httpd port/;
218+
s/^# use address localhost/ use address localhost/;
219+
s/^# allow localhost/ allow localhost/;
220+
s/^# allow admin:monit/ allow admin:monit/;
221+
s/^# allow @monit/ allow @monit/;
222+
s/^# allow @users readonly/ allow @users readonly/
223+
' $FILESYSTEM_ROOT/etc/monit/monitrc
224+
225+
sudo tee -a $FILESYSTEM_ROOT/etc/monit/monitrc > /dev/null <<'EOF'
226+
check filesystem root-aufs with path /
227+
if space usage > 90% for 5 times within 10 cycles then alert
228+
check system $HOST
229+
if memory usage > 90% for 5 times within 10 cycles then alert
230+
if cpu usage (user) > 90% for 5 times within 10 cycles then alert
231+
if cpu usage (system) > 90% for 5 times within 10 cycles then alert
232+
EOF
233+
212234
## Config sysctl
213235
sudo mkdir -p $FILESYSTEM_ROOT/var/core
214236
sudo augtool --autosave "

0 commit comments

Comments
 (0)