diff --git a/rootfs/etc/s6-overlay/s6-rc.d/prometheus-readsb/dependencies.d/startup b/rootfs/etc/s6-overlay/s6-rc.d/prometheus-readsb/dependencies.d/startup deleted file mode 100644 index e69de29..0000000 diff --git a/rootfs/etc/s6-overlay/s6-rc.d/prometheus-readsb/run b/rootfs/etc/s6-overlay/s6-rc.d/prometheus-readsb/run deleted file mode 100755 index 6f4275e..0000000 --- a/rootfs/etc/s6-overlay/s6-rc.d/prometheus-readsb/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -exec /etc/s6-overlay/scripts/prometheus-readsb diff --git a/rootfs/etc/s6-overlay/s6-rc.d/prometheus-readsb/type b/rootfs/etc/s6-overlay/s6-rc.d/prometheus-readsb/type deleted file mode 100644 index 5883cff..0000000 --- a/rootfs/etc/s6-overlay/s6-rc.d/prometheus-readsb/type +++ /dev/null @@ -1 +0,0 @@ -longrun diff --git a/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/prometheus-readsb b/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/prometheus-readsb deleted file mode 100644 index e69de29..0000000 diff --git a/rootfs/etc/s6-overlay/scripts/prometheus-readsb b/rootfs/etc/s6-overlay/scripts/prometheus-readsb deleted file mode 100755 index f23122f..0000000 --- a/rootfs/etc/s6-overlay/scripts/prometheus-readsb +++ /dev/null @@ -1,32 +0,0 @@ -#!/command/with-contenv bash -# shellcheck shell=bash disable=SC1091 - -source /scripts/common - -#--------------------------------------------------------------------------------------------- -# Copyright (C) 2023-2024, Ramon F. Kolb (kx1t) and contributors -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along with this program. -# If not, see . -#--------------------------------------------------------------------------------------------- - -if chk_enabled "$PROMETHEUS_ENABLE"; then - while [[ ! -f /run/readsb-prometheus.prom ]] - do - sleep 1 - done - trap "pkill -P $$ || true; s6wrap --timestamps --prepend=prometheus-readsb --quiet --args echo 'service stopping'; exit 0" SIGTERM SIGINT SIGHUP SIGQUIT - echo -e "HTTP/1.1 200 OK\nContent-Type: text/plain\n\n$(cat /run/readsb-prometheus.prom)" | ncat -l "${PROMETHEUSPORT:-9274}" > /dev/null 2>&1 & - wait -else - exec sleep infinity -fi diff --git a/rootfs/etc/s6-overlay/startup.d/99-prometheus-conf b/rootfs/etc/s6-overlay/startup.d/99-prometheus-conf new file mode 100755 index 0000000..c5d86ec --- /dev/null +++ b/rootfs/etc/s6-overlay/startup.d/99-prometheus-conf @@ -0,0 +1,24 @@ +#!/command/with-contenv bash + +source /scripts/common + +if ! chk_enabled "$PROMETHEUS_ENABLE"; then + exit 0 +fi + +# serve port 9274 always replying with stats.prom regardless of requested path + +cat > /etc/nginx/sites-enabled/prometheus_9274 <