diff --git a/monit/Dockerfile b/monit/Dockerfile index b472056..80b84c9 100644 --- a/monit/Dockerfile +++ b/monit/Dockerfile @@ -5,12 +5,12 @@ FROM alpine MAINTAINER kev -RUN apk add -U monit \ - && rm -rf /var/cache/apk/* +RUN apk add --no-cache monit -COPY monit /etc/monit +COPY data /etc/monit -RUN chmod 600 /etc/monit/monitrc \ +RUN set -xe \ + && chmod 600 /etc/monit/monitrc \ && ln -sf /etc/monit/monitrc /etc/monitrc \ && mkdir -p /var/lib/monit/events diff --git a/monit/data/conf.d/network.cfg b/monit/data/conf.d/network.cfg index 0a61565..b00cc51 100644 --- a/monit/data/conf.d/network.cfg +++ b/monit/data/conf.d/network.cfg @@ -1,4 +1,4 @@ check network eth0 with interface eth0 - if upload > 500 kB/s then alert - if total download > 3 GB in last 2 hours then alert - if total download > 30 GB in last day then alert + if upload > 500 kB/s then alert + if total download > 3 GB in last 2 hours then alert + if total download > 30 GB in last day then alert diff --git a/monit/data/conf.d/service.cfg b/monit/data/conf.d/service.cfg new file mode 100644 index 0000000..182423f --- /dev/null +++ b/monit/data/conf.d/service.cfg @@ -0,0 +1,9 @@ +check host httpbin with address httpbin.org + if failed + port 443 + protocol https + username "username" + password "********" + request "/get" + content = "Authorization" + then alert diff --git a/monit/data/conf.d/setting.cfg b/monit/data/conf.d/setting.cfg index 7f95bcb..6fa4176 100644 --- a/monit/data/conf.d/setting.cfg +++ b/monit/data/conf.d/setting.cfg @@ -1,3 +1,11 @@ set httpd port 2812 and - use address 0.0.0.0 - allow admin:monit readonly + use address 127.0.0.1 + allow admin:monit + allow guest:monit readonly + +set mailserver smtp.gmail.com port 587 + username "username" + password "********" + using ssl + +set alert username@gmail.com diff --git a/monit/data/conf.d/system.cfg b/monit/data/conf.d/system.cfg index 96a5c8f..871329d 100644 --- a/monit/data/conf.d/system.cfg +++ b/monit/data/conf.d/system.cfg @@ -1,4 +1,4 @@ -check system ss.easypi.info +check system monit.httpbin.org if loadavg (1min) > 4 then alert if loadavg (5min) > 2 then alert if memory usage > 80% then alert