knot-prometheus-exporter

This commit is contained in:
f 2020-10-21 16:14:29 -03:00
parent 84cf885986
commit 2c983d9e47
3 changed files with 15 additions and 1 deletions

View file

@ -1,10 +1,13 @@
FROM sutty/monit:latest FROM sutty/monit:latest
MAINTAINER "f <f@sutty.nl>" MAINTAINER "f <f@sutty.nl>"
RUN apk add --no-cache knot RUN echo
RUN apk add --no-cache knot knot-prometheus-exporter daemonize
COPY ./monit.conf /etc/monit.d/knot.conf COPY ./monit.conf /etc/monit.d/knot.conf
COPY ./prometheusd.sh /usr/local/bin/prometheusd
EXPOSE 53 EXPOSE 53
EXPOSE 53/udp EXPOSE 53/udp
EXPOSE 5000
VOLUME /var/lib/knot VOLUME /var/lib/knot

View file

@ -4,3 +4,7 @@ check process knot with pidfile /tmp/knot.pid
if 5 restarts within 8 cycles then alert 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 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 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"

7
prometheusd.sh Executable file
View file

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