Merge branch 'master' into antifascista
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
f 2022-03-08 09:14:25 -03:00
commit 5f14067191
3 changed files with 32 additions and 0 deletions

View file

@ -2,3 +2,13 @@ ARG ALPINE_VERSION=3.13.6
ARG BASE_IMAGE=sutty/monit
FROM ${BASE_IMAGE}:${ALPINE_VERSION}
MAINTAINER "f <f@sutty.nl>"
RUN apk add --no-cache knot knot-prometheus-exporter daemonize
COPY ./monit.conf /etc/monit.d/knot.conf
COPY ./prometheusd.sh /usr/local/bin/prometheusd
EXPOSE 53
EXPOSE 53/udp
EXPOSE 5000
VOLUME /var/lib/knot

10
monit.conf Normal file
View file

@ -0,0 +1,10 @@
check process knot with pidfile /tmp/knot.pid
start program = "/usr/sbin/knotd -d"
stop program = "/usr/sbin/knotc stop"
if 5 restarts within 8 cycles then alert
if failed port 53 type udp protocol dns for 3 times within 5 cycles then restart
if failed port 53 type tcp protocol dns for 3 times within 5 cycles then restart
check process prometheus with pidfile /tmp/prometheus.pid
start program = "/usr/local/bin/prometheusd start"
stop program = "/usr/local/bin/prometheusd stop"

12
prometheusd.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
set -e
STATS=${STATS:-/tmp/stats.yaml}
case $1 in
start)
rm -f /tmp/prometheus.pid
daemonize -c /tmp -p /tmp/prometheus.pid -l /tmp/prometheus.pid -u knot /usr/bin/knot-prometheus-exporter ${STATS}
;;
stop) cat /tmp/prometheus.pid | xargs -r kill ;;
esac