configurable email
This commit is contained in:
parent
0c9ca5f55b
commit
755c3c75d6
3 changed files with 14 additions and 2 deletions
|
@ -7,11 +7,14 @@ pipeline:
|
|||
- ${ALPINE_VERSION}
|
||||
- latest
|
||||
build_args:
|
||||
- EMAIL=${MONIT_EMAIL}
|
||||
- EMAIL_FROM=${MONIT_EMAIL_FROM}
|
||||
- ALPINE_VERSION=${ALPINE_VERSION}
|
||||
- BASE_IMAGE=alpine
|
||||
username: sutty
|
||||
secrets:
|
||||
- docker_password
|
||||
- DOCKER_PASSWORD
|
||||
- MONIT_EMAIL
|
||||
cache_from: registry.nulo.in/sutty/monit:${ALPINE_VERSION}
|
||||
docker:
|
||||
purge: false
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
ARG ALPINE_VERSION=3.13.6
|
||||
ARG BASE_IMAGE=alpine
|
||||
ARG EMAIL=monit@sutty.nl
|
||||
ARG EMAIL_FROM=monit@sutty.nl
|
||||
FROM ${BASE_IMAGE}:${ALPINE_VERSION} as build
|
||||
ENV EMAIL ${EMAIL:-monit@sutty.nl}
|
||||
ARG EMAIL
|
||||
ARG EMAIL_FROM
|
||||
|
||||
RUN apk add --no-cache tzdata
|
||||
|
||||
COPY ./monitrc /etc/monitrc
|
||||
RUN chmod 600 /etc/monitrc
|
||||
RUN sed -re "s/@@EMAIL@@/${EMAIL}/" -i /etc/monitrc
|
||||
RUN sed -re "s/@@EMAIL_FROM@@/${EMAIL_FROM}/" -i /etc/monitrc
|
||||
|
||||
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
|
||||
ARG ALPINE_VERSION
|
||||
|
|
6
monitrc
6
monitrc
|
@ -18,4 +18,10 @@ check program nsupdate
|
|||
every 1 cycle
|
||||
if status = 0 then unmonitor
|
||||
|
||||
set mail-format {
|
||||
from: Monit <@@EMAIL_FROM@@>
|
||||
subject: $SERVICE@$HOST
|
||||
message: $ACTION $SERVICE -- $DATE -- $HOST: $DESCRIPTION.
|
||||
}
|
||||
|
||||
include /etc/monit.d/*.conf
|
||||
|
|
Loading…
Reference in a new issue