actually work
This commit is contained in:
parent
f106771da9
commit
34ac360bfc
3 changed files with 24 additions and 4 deletions
|
@ -2,6 +2,7 @@ FROM sutty/monit:latest
|
||||||
MAINTAINER "f <f@sutty.nl>"
|
MAINTAINER "f <f@sutty.nl>"
|
||||||
|
|
||||||
RUN apk add --no-cache prometheus daemonize
|
RUN apk add --no-cache prometheus daemonize
|
||||||
|
COPY ./monit.conf /etc/monit.d/prometheus.conf
|
||||||
COPY ./prometheusd.sh /usr/local/bin/prometheusd
|
COPY ./prometheusd.sh /usr/local/bin/prometheusd
|
||||||
|
|
||||||
EXPOSE 9090
|
EXPOSE 9090
|
||||||
|
|
4
monit.conf
Normal file
4
monit.conf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
check process postfix with pidfile /var/spool/postfix/pid/master.pid
|
||||||
|
start program = "/usr/local/bin/prometheusd start"
|
||||||
|
stop program = "/usr/local/bin/prometheusd stop"
|
||||||
|
if 5 restarts within 8 cycles then alert
|
|
@ -2,9 +2,24 @@
|
||||||
|
|
||||||
pid=/tmp/prometheus.pid
|
pid=/tmp/prometheus.pid
|
||||||
var=/var/lib/prometheus
|
var=/var/lib/prometheus
|
||||||
log=/dev/log
|
|
||||||
|
case $1 in
|
||||||
|
stop)
|
||||||
|
test -f "${pid}" || exit 0
|
||||||
|
|
||||||
|
cat "${pid}" | xargs -r kill
|
||||||
|
|
||||||
|
rm "${pid}"
|
||||||
|
;;
|
||||||
|
start)
|
||||||
|
rm -f "${pid}"
|
||||||
|
|
||||||
chown prometheus:prometheus /var/lib/prometheus/data
|
chown prometheus:prometheus /var/lib/prometheus/data
|
||||||
|
chmod -R u=rwX,g=rX,o= /var/lib/prometheus
|
||||||
|
|
||||||
daemonize -p "${pid}" -l "${pid}" -u prometheus -c "${var}" -a -o "${log}" -e "${log}" \
|
daemonize -p "${pid}" -l "${pid}" -u prometheus -c "${var}" \
|
||||||
/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path="${var}/data"
|
/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path="${var}/data"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $?
|
||||||
|
|
Loading…
Reference in a new issue