Merge branch 'master' into antifascista
This commit is contained in:
commit
38c39af601
3 changed files with 36 additions and 0 deletions
|
@ -2,3 +2,10 @@ ARG ALPINE_VERSION=3.13.6
|
||||||
ARG BASE_IMAGE=sutty/monit
|
ARG BASE_IMAGE=sutty/monit
|
||||||
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
|
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
|
||||||
MAINTAINER "f <f@sutty.nl>"
|
MAINTAINER "f <f@sutty.nl>"
|
||||||
|
|
||||||
|
RUN apk add --no-cache prometheus daemonize
|
||||||
|
COPY ./monit.conf /etc/monit.d/prometheus.conf
|
||||||
|
COPY ./prometheusd.sh /usr/local/bin/prometheusd
|
||||||
|
|
||||||
|
EXPOSE 9090
|
||||||
|
VOLUME /var/lib/prometheus
|
||||||
|
|
4
monit.conf
Normal file
4
monit.conf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
check process prometheus with pidfile /tmp/prometheus.pid
|
||||||
|
start program = "/usr/local/bin/prometheusd start"
|
||||||
|
stop program = "/usr/local/bin/prometheusd stop"
|
||||||
|
if 5 restarts within 8 cycles then alert
|
25
prometheusd.sh
Executable file
25
prometheusd.sh
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
pid=/tmp/prometheus.pid
|
||||||
|
var=/var/lib/prometheus
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
stop)
|
||||||
|
test -f "${pid}" || exit 0
|
||||||
|
|
||||||
|
cat "${pid}" | xargs -r kill
|
||||||
|
|
||||||
|
rm "${pid}"
|
||||||
|
;;
|
||||||
|
start)
|
||||||
|
rm -f "${pid}"
|
||||||
|
|
||||||
|
chown prometheus:prometheus "${var}"
|
||||||
|
chmod -R u=rwX,g=rX,o= "${var}"
|
||||||
|
|
||||||
|
daemonize -p "${pid}" -l "${pid}" -u prometheus -c "${var}" \
|
||||||
|
/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path="${var}/data"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
Loading…
Reference in a new issue