Skip to content

Commit

Permalink
prometheus stuff (#243)
Browse files Browse the repository at this point in the history
Move some stuff around, fixup some readme.

And hopefully fix this:
sdr-enthusiasts/docker-adsb-ultrafeeder#160
(without needing to do hacks in the prometheus config)
  • Loading branch information
wiedehopf authored Nov 15, 2024
1 parent 1f1392b commit c44ac03
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,6 @@ In order for Telegraf to serve a [Prometheus](https://prometheus.io) endpoint, t
| Variable | Description |
| ------------------- | ------------------------------------------------------------------------ |
| `PROMETHEUS_ENABLE` | Set to `true` for a Prometheus endpoint on `http://0.0.0.0:9273/metrics` |
| `PROMETHEUSPORT` | TCP port for the Prometheus endpoint. Default value is 9273 |

## Minimalist setup

Expand Down
27 changes: 27 additions & 0 deletions rootfs/etc/s6-overlay/startup.d/99-prometheus-conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/command/with-contenv bash
#shellcheck shell=bash disable=SC1091

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 <<EOF
server {
listen 9274 default_server;
root /var/www/html;
server_name _;
location /metrics {
default_type text/plain;
alias /run/readsb/stats.prom;
}
location / {
default_type text/plain;
alias /run/readsb/stats.prom;
rewrite (.*) /metrics last;
}
}
EOF

0 comments on commit c44ac03

Please sign in to comment.